Exemple #1
0
 /**
  * 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;
 }
Exemple #2
0
    public function testFactory()
    {
        $cfg = array('log' => array('memory' => array(
            'writerName' => "Mock"
        )));

        $logger = Logger::factory($cfg['log']);
        $this->assertTrue($logger instanceof Logger);
    }
Exemple #3
0
 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);
 }
Exemple #4
0
 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);
 }
Exemple #5
0
 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'))));
 }
Exemple #6
0
 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);
 }
Exemple #7
0
 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);
 }
Exemple #8
0
    /**
     * @group ZF-10990
     */
    public function testFactoryShouldKeepDefaultTimestampFormat()
    {
        $config = array(
            'timestampFormat' => '',
            'mock' => array(
                'writerName' => 'Mock'
            )
        );
        $logger = Logger::factory($config);

        $this->assertEquals('c', $logger->getTimestampFormat());
    }