Use proper log level depending on debug mode

This commit is contained in:
Alexander Skvortsov 2022-01-05 21:45:27 -05:00
parent 7cec4d1f42
commit 687e1e2789
No known key found for this signature in database
GPG Key ID: C4E3BBF9C3412B4C

View File

@ -174,7 +174,8 @@ class InstalledSite implements SiteInterface
protected function registerLogger(Container $container) protected function registerLogger(Container $container)
{ {
$logPath = $this->paths->storage.'/logs/flarum.log'; $logPath = $this->paths->storage.'/logs/flarum.log';
$handler = new RotatingFileHandler($logPath, 0, Logger::INFO); $logLevel = $this->config->inDebugMode() ? Logger::DEBUG : Logger::INFO;
$handler = new RotatingFileHandler($logPath, 0, $logLevel);
$handler->setFormatter(new LineFormatter(null, null, true, true)); $handler->setFormatter(new LineFormatter(null, null, true, true));
$container->instance('log', new Logger('flarum', [$handler])); $container->instance('log', new Logger('flarum', [$handler]));