diff --git a/src/StaticPHP/Command/CraftCommand.php b/src/StaticPHP/Command/CraftCommand.php index 86494902..4ec67e6b 100644 --- a/src/StaticPHP/Command/CraftCommand.php +++ b/src/StaticPHP/Command/CraftCommand.php @@ -36,6 +36,15 @@ class CraftCommand extends BaseCommand // set 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 array_walk($craft['extra-env'], fn ($v, $k) => f_putenv("{$k}={$v}"));