Enable console debug depending on environment

This commit is contained in:
MilosEsokia
2019-05-07 14:44:34 +02:00
parent 904b67192e
commit 7ddf7b61e6

View File

@@ -73,9 +73,17 @@ class CLI extends Application
$this->bindRoutes();
$this['logger'] = $this->extend('logger', function () {
return new Console\Logger\ConsoleLogger(new Console\Output\ConsoleOutput(Console\Output\ConsoleOutput::VERBOSITY_DEBUG));
});
$logger = false;
$config = $this['configuration.store']->getConfig();
if ((isset($config['console_logger_enabled_environments']) && in_array($environment, $config['console_logger_enabled_environments'])) || $environment == self::ENV_DEV){
$logger = true;
}
if ($logger){
$this['logger'] = $this->extend('logger', function () {
return new Console\Logger\ConsoleLogger(new Console\Output\ConsoleOutput(Console\Output\ConsoleOutput::VERBOSITY_DEBUG));
});
}
error_reporting(-1);
ErrorHandler::register();