From 68db46e4cc5d5bf014158acfd271f45d5edded4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 2 Aug 2021 10:29:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Error/Logger.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/System/Error/Logger.php b/System/Error/Logger.php index f993944f..2ef216aa 100644 --- a/System/Error/Logger.php +++ b/System/Error/Logger.php @@ -181,14 +181,10 @@ class Logger extends Component } $to_day = date('Y-m-d'); - if (!isset($this->sources[$to_day])) $this->sources[$to_day] = []; $fileName = storage('server-' . $to_day . '.log', $dirName = 'log/' . ($method ?? 'app')); - if (!isset($this->sources[$to_day][$fileName]) || !is_resource($this->sources[$to_day][$fileName])) { - $this->sources[$to_day][$fileName] = fopen($fileName, 'rw'); - } try { - fwrite($this->sources[$to_day][$fileName], '[' . date('Y-m-d H:i:s') . ']:' . PHP_EOL . $messages . PHP_EOL); + file_put_contents($fileName, '[' . date('Y-m-d H:i:s') . ']:' . PHP_EOL . $messages . PHP_EOL); } catch (Throwable $exception) { $this->output($exception->getMessage()); }