jeet0291 / apns-php

Automatically exported from code.google.com/p/apns-php
0 stars 0 forks source link

Not able to turn off the logging, or to only log on errors #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, i'm using apns-php in a cron job, and i receive an email each time the cron 
job gets executed. I want to receive emails, if there's something wrong or so, 
so i don't want to turn the logging off completely, and i also don't wanna 
'2>&1 > /dev/null' it. It would be perfect if im able to set something like 
$apns->loggerType = LOGGER_ERRORS_ONLY; or something like that ... i would take 
minutes to do such feature, and i will really appreciate it. and sorry i 
reported it as an error, but i don't see other place to write :)

Original issue reported on code.google.com by kuk...@gmail.com on 30 Dec 2010 at 7:32

GoogleCodeExporter commented 8 years ago
Hi.

You have to create a new class that implements ApnsPHP_Log_Interface Interface 
and then call $push->setLogger(your class instance).

In your class, log method you can explode message at the semicolon and then 
only if first part is WARNING or ERROR do an echo/printf.

This is not "a software" but a library that you can use as you want: you can 
use the APIs to manage the library (please, read APIs docs).

Original comment by aldo.arm...@gmail.com on 30 Dec 2010 at 7:42

GoogleCodeExporter commented 8 years ago
This is a very old thread but if anyone runs into this in the future and does 
not want to implement their own Log_Interface the printf() in \Log\Embedded.php 
just needs to be commented out or replaced with your own preferred logging 
method.

Original comment by files...@gmail.com on 2 Jul 2014 at 9:13