Ejemplo n.º 1
0
 /**
  * @param ConfigInterface $config
  * @param string $level
  * @param int $loggerLevel
  * @return HandlerInterface
  */
 private function createHandler(ConfigInterface $config, $level, $loggerLevel)
 {
     $factory = new LoggerFactory();
     $formatter = $factory->createFormatter('LineFormatter', [$config->get('log.config.messagePattern'), $config->get('log.config.datePattern'), true]);
     $filePermission = $config->get('log.config.filePermission');
     $fileLocking = (bool) $config->get('log.config.fileLocking');
     $filePath = $config->get('log.config.filePattern');
     $loggerHandler = $factory->createHandler('StreamHandler', [$this->filePath($filePath, $level), $loggerLevel, false, $filePermission, $fileLocking]);
     $loggerHandler->setFormatter($formatter);
     return $loggerHandler;
 }
Ejemplo n.º 2
0
 /**
  * @param int $loggerLevel
  * @return HandlerInterface
  */
 private function createHandler($loggerLevel)
 {
     $factory = new LoggerFactory();
     $level = $this->getLevelName($loggerLevel);
     $formatter = $factory->createFormatter('LineFormatter', [$this->messagePattern, $this->datePattern, true]);
     $filePermission = 0755;
     $fileLocking = false;
     $filePath = $this->filePattern;
     $loggerHandler = $factory->createHandler('StreamHandler', [$this->filePath($filePath, $level), $loggerLevel, false, $filePermission, $fileLocking]);
     $loggerHandler->setFormatter($formatter);
     return $loggerHandler;
 }