Example #1
0
 /**
  * @covers \Plop\Logger::__construct
  * @covers \Plop\Logger::getNamespace
  * @covers \Plop\Logger::getClass
  * @covers \Plop\Logger::getMethod
  */
 public function testConstructorWithSpecificArguments2()
 {
     $logger = new \Plop\Logger(null, __CLASS__, __FUNCTION__);
     $this->assertSame(null, $logger->getNamespace());
     $this->assertSame(substr(__CLASS__, strrpos('\\' . __CLASS__, '\\')), $logger->getClass());
     $this->assertSame(__FUNCTION__, $logger->getMethod());
     $this->assertSame(\Plop\NOTSET, $this->logger->getLevel());
     $this->assertSame(0, count($this->logger->getHandlers()));
     $this->assertSame(0, count($this->logger->getFilters()));
 }
Example #2
0
File: Plop.php Project: erebot/plop
 /**
  * Create a new instance of the logging service.
  */
 protected function __construct()
 {
     $this->loggers = array();
     $rootLogger = new \Plop\Logger(null, null);
     $basicHandler = new \Plop\Handler\Stream(fopen('php://stderr', 'w'));
     $this[] = $rootLogger;
     $handlers = $rootLogger->getHandlers();
     $formatter = new \Plop\Formatter(self::BASIC_FORMAT);
     $handlers[] = $basicHandler->setFormatter($formatter);
     $this->created = microtime(true);
     $this->levelNames = array(\Plop\NOTSET => 'NOTSET', \Plop\DEBUG => 'DEBUG', \Plop\INFO => 'INFO', \Plop\NOTICE => 'NOTICE', \Plop\WARNING => 'WARNING', \Plop\ERROR => 'ERROR', \Plop\CRITICAL => 'CRITICAL', \Plop\ALERT => 'ALERT', \Plop\EMERGENCY => 'EMERGENCY');
 }