Example #1
0
 function testLog()
 {
     $msg = 'Base Class test log';
     $t = date('Y-m-d H:i:s', time());
     $file = dirname(__FILE__) . '/logfile.txt';
     file_put_contents($file, '');
     Raxan::config('log.enable', true);
     Raxan::config('log.file', $file);
     // log
     $base = new BaseClass();
     $base->log($msg);
     $c = file_get_contents($file);
     $this->compare("INFO \t" . $t . " \t \t" . $msg, trim($c), 'Log file content');
     // log with params
     file_put_contents($file, '');
     $base->log($msg, 'ERROR', 'Label');
     $t = date('Y-m-d H:i:s', time());
     $c = file_get_contents($file);
     $this->compare("ERROR \t" . $t . " \t [Label] \t" . $msg, trim($c), 'Log with label params');
 }