From 2b210f940365885f9765a6b7913504fc7322f66d Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Mon, 22 Jun 2026 13:33:02 +0800 Subject: [PATCH] feat(logging): synchronize logger level and debug mode with output verbosity --- src/StaticPHP/Command/CraftCommand.php | 9 +++++++++ 1 file changed, 9 insertions(+) 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}"));