'onInitLogger', ]; } /** * @param ServiceContainer $container * * @return Logger */ public static function onInitLogger(ServiceContainer $container): Logger { $request = $container->get('Request'); $logLevel = LogLevel::ERROR; if ($container->has('LoggerConfigService')) { /** @var LoggerConfigService $cfg */ $cfg = $container->get('LoggerConfigService'); try { $logLevel = $cfg->getLogLevel(); } catch (InvalidLoglevelException $e) { } } $contextHelper = new ContextHelper($request); $logger = new Logger($contextHelper); $handler = new DatabaseLogHandler($container->get('Database'), $logLevel); $logger->pushHandler($handler); return $logger; } }