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[] | |
Résultat | Kraken\Log\Handler\HandlerInterface |
/** * @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; }
/** * @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; }