Пример #1
0
 public function __construct(Search_Index_Interface $searchIndex, $logWriter = null)
 {
     if (!$logWriter instanceof Zend_Log_Writer_Abstract) {
         $logWriter = new Zend_Log_Writer_Null();
     }
     $logWriter->setFormatter(new Zend_Log_Formatter_Simple(Zend_Log_Formatter_Simple::DEFAULT_FORMAT . ' [%memoryUsage% bytes]' . PHP_EOL));
     $this->log = new Zend_Log($logWriter);
     $this->searchIndex = $searchIndex;
 }
Пример #2
0
 public function __construct(Search_Index_Interface $searchIndex, $loggit = false)
 {
     if ($loggit) {
         // unused externally, set this to true here to enable logging
         global $prefs;
         $writer = new Zend_Log_Writer_Stream($prefs['tmpDir'] . '/Search_Indexer.log', 'w');
     } else {
         $writer = new Zend_Log_Writer_Null();
     }
     $writer->setFormatter(new Zend_Log_Formatter_Simple(Zend_Log_Formatter_Simple::DEFAULT_FORMAT . ' [%memoryUsage% bytes]' . PHP_EOL));
     $this->log = new Zend_Log($writer);
     $this->searchIndex = $searchIndex;
 }
Пример #3
0
 public function testWrite()
 {
     $writer = new Zend_Log_Writer_Null();
     $writer->write(array('message' => 'foo', 'priority' => 42));
 }
Пример #4
0
 public function testWrite()
 {
     $writer = new Zend_Log_Writer_Null();
     $this->assertTrue($writer->write('foo', 42));
 }
Пример #5
0
 /**
  * Log a message at a priority.
  * If called with no arguments at all, this method will return
  * the current Zend_Log instance.
  *
  * @param  string   $message   Message to log
  * @param  integer  $priority  Priority of message
  * @param  mixed    $extras    Extra information to log in event
  * @return void
  * @throws Zend_Log_Exception
  */
 public static function log($message = null, $priority = null, $extras = null)
 {
     if (is_null(self::$log)) {
         // we initialize the log with the Null Writer in case the user
         // does not specify any other writer
         self::$log = new \Zend_Log(\Zend_Log_Writer_Null::factory(array()));
     }
     if (is_null($message) && is_null($priority) && is_null($extras)) {
         return self::$log;
     }
     self::$log->log($message, $priority, $extras);
 }