示例#1
0
 /**
  * Test $log->write()
  * 
  * @access public
  * @return void
  */
 function test_write()
 {
     $log = new Minion_Log();
     $writer = $this->getMockForAbstractClass('Log_Writer');
     $on_add = $this->getMockForAbstractClass('Log_Writer');
     $log->attach($writer);
     $log->attach($on_add, array(), 0, TRUE);
     // Should be called on $log->write()
     $writer->expects($this->once())->method('write');
     // Should be called on $log->add()
     $on_add->expects($this->once())->method('write');
     $log->add(Log::INFO, "foobar");
     $log->write();
 }
示例#2
0
 /**
  * Get the singleton instance of this class and enable writing at shutdown.
  * This can be different from the default Kohana logger
  *
  *     $log = Minion_Log::instance();
  *
  * @return  Minion_Log
  */
 public static function instance()
 {
     if (Minion_Log::$_instance === NULL) {
         // Create a new instance
         Minion_Log::$_instance = new Minion_Log();
         // Write the logs at shutdown
         register_shutdown_function(array(Minion_Log::$_instance, 'write'));
     }
     return Minion_Log::$_instance;
 }