From a3f2168f3a29e4dd017083679fb041c5d40065dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Wed, 19 Apr 2023 12:41:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kiri-engine/Abstracts/Logger.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kiri-engine/Abstracts/Logger.php b/kiri-engine/Abstracts/Logger.php index 8917943a..75b17edc 100644 --- a/kiri-engine/Abstracts/Logger.php +++ b/kiri-engine/Abstracts/Logger.php @@ -35,7 +35,6 @@ class Logger implements LoggerInterface private array $levels = []; - public function __construct() { $this->levels = Config::get('log.level', Logger::LOGGER_LEVELS); @@ -146,8 +145,10 @@ class Logger implements LoggerInterface if (!in_array($level, $this->levels)) { return; } - $_string = "[" . now() . ']' . ucfirst($level) . ": " . $message . PHP_EOL; - if (!empty($context)) $_string .= $this->_string($context); + $_string = "[" . now() . ']' . ucfirst($level) . ": " . $message; + if (!empty($context)) { + $_string .= PHP_EOL . $this->_string($context); + } if (str_contains($_string, 'Event::rshutdown')) { return; } @@ -206,6 +207,6 @@ class Logger implements LoggerInterface if (is_string($context)) { return $context . PHP_EOL; } - return implode(PHP_EOL, $context) . PHP_EOL; + return implode(PHP_EOL, $context); } }