/** * Retrieve logger * * @return \Zend\Log\Logger */ public function getLog() { if (null === $this->_log) { $options = $this->getOptions(); $log = ZendLog\Logger::factory($options); $this->setLog($log); } return $this->_log; }
public function testFactory() { $cfg = array('log' => array('memory' => array( 'writerName' => "Mock" ))); $logger = Logger::factory($cfg['log']); $this->assertTrue($logger instanceof Logger); }
public function testFactory() { $cfg = array('log' => array('memory' => array('writerName' => "Db", 'writerParams' => array('db' => $this->db, 'table' => $this->tableName)))); $logger = Logger::factory($cfg['log']); $this->assertTrue($logger instanceof Logger); }
public function testFactoryUrl() { $cfg = array('log' => array('memory' => array('writerName' => "Mock", 'writerParams' => array('url' => 'http://localhost', 'mode' => 'a')))); $logger = Logger::factory($cfg['log']); $this->assertTrue($logger instanceof Logger); }
public function testFactoryRaisesExceptionWithInvalidPriority() { $this->setExpectedException('Zend\\Log\\Exception\\InvalidArgumentException', 'must be an integer'); $logger = Logger::factory(array('Null' => array('writerName' => 'Mock', 'filterName' => 'Priority', 'filterParams' => array('priority' => 'somestring')))); }
public function testFactory() { $cfg = array('log' => array('memory' => array('writerName' => "Mock", 'filterName' => "Message", 'filterParams' => array('regexp' => "/42/")))); $logger = Logger::factory($cfg['log']); $this->assertTrue($logger instanceof Logger); }
public function testFactoryUsesNameAndNamespaceWithoutModifications() { $cfg = array('log' => array('memory' => array('writerName' => "ZendMonitor", 'writerNamespace' => "Zend\\Log\\Writer"))); $logger = Logger::factory($cfg['log']); $this->assertTrue($logger instanceof Logger); }
/** * @group ZF-10990 */ public function testFactoryShouldKeepDefaultTimestampFormat() { $config = array( 'timestampFormat' => '', 'mock' => array( 'writerName' => 'Mock' ) ); $logger = Logger::factory($config); $this->assertEquals('c', $logger->getTimestampFormat()); }