createHandler() публичный Метод

Create one of Monolog handlers by specifying it name or full class.
public createHandler ( string $classOrName, mixed[] $args = [] ) : Kraken\Log\Handler\HandlerInterface
$classOrName string
$args mixed[]
Результат Kraken\Log\Handler\HandlerInterface
Пример #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;
 }
Пример #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;
 }