mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-09 09:55:37 +08:00
feat(logging): synchronize logger level and debug mode with output verbosity
This commit is contained in:
@@ -36,6 +36,15 @@ class CraftCommand extends BaseCommand
|
|||||||
// set verbosity
|
// set verbosity
|
||||||
$this->output->setVerbosity($craft['verbosity']);
|
$this->output->setVerbosity($craft['verbosity']);
|
||||||
|
|
||||||
|
// sync logger level and ApplicationContext debug mode to match the new verbosity
|
||||||
|
$level = match ($this->output->getVerbosity()) {
|
||||||
|
OutputInterface::VERBOSITY_VERBOSE => 'info',
|
||||||
|
OutputInterface::VERBOSITY_VERY_VERBOSE, OutputInterface::VERBOSITY_DEBUG => 'debug',
|
||||||
|
default => 'warning',
|
||||||
|
};
|
||||||
|
logger()->setLevel($level);
|
||||||
|
ApplicationContext::setDebug($this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG);
|
||||||
|
|
||||||
// apply env
|
// apply env
|
||||||
array_walk($craft['extra-env'], fn ($v, $k) => f_putenv("{$k}={$v}"));
|
array_walk($craft['extra-env'], fn ($v, $k) => f_putenv("{$k}={$v}"));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user