From f5931ee9fcbc8f0871fbfb4e3c848c65f5e8f5cf Mon Sep 17 00:00:00 2001 From: hongfs Date: Sun, 13 Aug 2023 09:51:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=9B=91=E5=90=AC=E4=BA=8B=E4=BB=B6=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/think/log/Channel.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) {