Saving Log Messages in array for writing a Logfile

19 views
Skip to first unread message

alex

unread,
Feb 25, 2016, 4:13:05 PM2/25/16
to apns-php
Hello,

I am not a professional what classes and interfaces concerns, and I am going crazy now...

Have seen this topic (https://groups.google.com/forum/#!topic/apns-php/ddN2LOaBy8M).

If I display the Message with "echo $sMessage" or something else, everything works fine.

But I wants to fill an array and use it later for writing it to an logfile (With APNS Log Messages and other Informations...

Here is my code:

    class logAPNS implements ApnsPHP_Log_Interface {

        public $appleLogs = array();

        public function log($sMessage) {
            global $appleLogs;

            //$appleLogs[]['date']    = date('r');
            //$appleLogs[]['pid']     = getmypid();
            //$appleLogs[]['message'] = $sMessage;

            array_push($this->$appleLogs, 'test');
        }
    }

    $appleLogger = new
logAPNS;

    $apns_push->setLogger($appleLogger);
    $apns_push->connect();

    //print_r($apns_push->getLogger());
    print_r($appleLogs);


I know, it's not a bug or specially apns-php problem, but I hope that you can eventually short explain to me what I'm doing wrong...


Thank you (and sorry for my bad english!)

Alex

Reply all
Reply to author
Forward
0 new messages