Ejemplo n.º 1
0
 /**
  * global test
  * 
  * @test
  * @return void
  * @author Sherlock Ren <*****@*****.**>
  */
 public function globalTest()
 {
     $hander = new FileHandler('/tmp/test.log');
     $this->assertTrue($hander instanceof $hander);
     $this->assertEquals('/tmp/test.log', $hander->link);
     $hander->setFormatter(new JsonFormatter());
     $this->assertTrue($hander->formatter instanceof FormatterInterface);
     $hander->setLink('/tmp/test.error');
     $this->assertEquals('/tmp/test.error', $hander->link);
     $hander->setLock(false);
     $this->assertFalse($hander->lock);
     $this->assertTrue($hander->handle(['test']));
 }
Ejemplo n.º 2
0
 /**
  * write test
  * 
  * @test
  * @return void
  * @author Sherlock Ren <*****@*****.**>
  */
 public function write()
 {
     $logger = new Logger('test');
     $hander = new FileHandler();
     $hander->useDaily('/tmp/test.log');
     $logger->setHandler($hander);
     $logger->pushProcessor(new LogIdProcessor());
     $logger->pushProcessor(new PushProcessor(['host_ip', 'product'], ['12312', '123']));
     $this->assertEquals('test', $logger->getName());
     $this->assertTrue($logger->log('info', 'log'));
     $this->assertTrue($logger->debug('debug'));
     $this->assertTrue($logger->info('info'));
     $this->assertTrue($logger->notice('notice'));
     $this->assertTrue($logger->warning('warning'));
     $this->assertTrue($logger->error('error'));
     $this->assertTrue($logger->critical('critical'));
     $this->assertTrue($logger->alert('alert'));
     $this->assertTrue($logger->emergency('emergency'));
 }