From 7ddf7b61e63cddbcc07eebcb67d9c9369a270611 Mon Sep 17 00:00:00 2001 From: MilosEsokia Date: Tue, 7 May 2019 14:44:34 +0200 Subject: [PATCH 1/3] Enable console debug depending on environment --- lib/Alchemy/Phrasea/CLI.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/Alchemy/Phrasea/CLI.php b/lib/Alchemy/Phrasea/CLI.php index 0d6fc27774..4c6dae3e51 100644 --- a/lib/Alchemy/Phrasea/CLI.php +++ b/lib/Alchemy/Phrasea/CLI.php @@ -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(); From 31a4acda0e12d8daa6203b5f963cc8c4040ec624 Mon Sep 17 00:00:00 2001 From: MilosEsokia Date: Wed, 8 May 2019 11:03:03 +0200 Subject: [PATCH 2/3] Check if config exists --- lib/Alchemy/Phrasea/CLI.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/Alchemy/Phrasea/CLI.php b/lib/Alchemy/Phrasea/CLI.php index 4c6dae3e51..9eb1302225 100644 --- a/lib/Alchemy/Phrasea/CLI.php +++ b/lib/Alchemy/Phrasea/CLI.php @@ -74,8 +74,17 @@ class CLI extends Application $this->bindRoutes(); $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){ + + if ($this['configuration.store']->isSetup()){ + + $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 ($environment == self::ENV_DEV){ $logger = true; } From fa547e15e66e5ace07d3c5fb222e4870a6620255 Mon Sep 17 00:00:00 2001 From: MilosEsokia Date: Tue, 14 May 2019 13:15:32 +0200 Subject: [PATCH 3/3] Removing duplicated clause --- lib/Alchemy/Phrasea/CLI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/CLI.php b/lib/Alchemy/Phrasea/CLI.php index 9eb1302225..eb1c780740 100644 --- a/lib/Alchemy/Phrasea/CLI.php +++ b/lib/Alchemy/Phrasea/CLI.php @@ -79,7 +79,7 @@ class CLI extends Application $config = $this['configuration.store']->getConfig(); - if ((isset($config['console_logger_enabled_environments']) && in_array($environment, $config['console_logger_enabled_environments'])) || $environment == self::ENV_DEV){ + if ((isset($config['console_logger_enabled_environments']) && in_array($environment, $config['console_logger_enabled_environments']))){ $logger = true; } }