コード例 #1
0
ファイル: Stream.php プロジェクト: JeroenBoersma/Srcode_Log
 /**
  * Write how often last message is repeated
  *
  * @throws Zend_Log_Exception
  */
 protected function _writeRepeated()
 {
     if ($this->_lastMessageCount < 2) {
         // Do nothing
         return;
     }
     $log = new Zend_Log();
     $event = array('timestamp' => date($log->getTimestampFormat()), 'priorityName' => 'DEBUG', 'priority' => Zend_Log::DEBUG, 'message' => sprintf("Last message repeated %s times", $this->_lastMessageCount));
     $line = $this->_formatter->format($event);
     if (false === @fwrite($this->_stream, $line)) {
         #require_once 'Zend/Log/Exception.php';
         throw new Zend_Log_Exception("Unable to write to stream");
     }
 }
コード例 #2
0
 /**
  * @group ZF-9870
  */
 public function testSetAndGetTimestampFormat()
 {
     $logger = new Zend_Log($this->writer);
     $this->assertEquals('c', $logger->getTimestampFormat());
     $this->assertSame($logger, $logger->setTimestampFormat('Y-m-d H:i:s'));
     $this->assertEquals('Y-m-d H:i:s', $logger->getTimestampFormat());
 }