diff --git a/src/think/log/Channel.php b/src/think/log/Channel.php index ee7c33e6c7..bf4c3ceda3 100644 --- a/src/think/log/Channel.php +++ b/src/think/log/Channel.php @@ -44,6 +44,9 @@ class Channel implements LoggerInterface public function __construct(protected string $name, protected LogHandlerInterface $logger, protected array $allow = [], protected bool $lazy = true, Event $event = null) { + if($event) { + $this->event = $event; + } } /** @@ -81,7 +84,7 @@ public function record($msg, string $type = 'info', array $context = [], bool $l if ($msg instanceof Stringable) { $msg = $msg->__toString(); } - + if (is_string($msg) && !empty($context)) { $replace = []; foreach ($context as $key => $val) {