From df2e645d3dc61f4f4338a1864297991b1797ed55 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 11 Jan 2019 17:45:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=91=BD=E4=BB=A4=E8=A1=8C?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/log/driver/File.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/library/think/log/driver/File.php b/library/think/log/driver/File.php index 24fd1474f8..400b2040c3 100644 --- a/library/think/log/driver/File.php +++ b/library/think/log/driver/File.php @@ -85,13 +85,11 @@ public function save(array $log = [], $append = false) */ protected function getMasterLogFile() { + $cli = PHP_SAPI == 'cli' ? '_cli' : ''; if ($this->config['single']) { - $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; - - $destination = $this->config['path'] . $name . '.log'; + $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; + $destination = $this->config['path'] . $name . $cli . '.log'; } else { - $cli = PHP_SAPI == 'cli' ? '_cli' : ''; - if ($this->config['max_files']) { $filename = date('Ymd') . $cli . '.log'; $files = glob($this->config['path'] . '*.log'); @@ -125,15 +123,13 @@ protected function getApartLevelFile($path, $type) if ($this->config['single']) { $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; - - $name .= '_' . $type; } elseif ($this->config['max_files']) { - $name = date('Ymd') . '_' . $type . $cli; + $name = date('Ymd'); } else { - $name = date('d') . '_' . $type . $cli; + $name = date('d'); } - return $path . DIRECTORY_SEPARATOR . $name . '.log'; + return $path . DIRECTORY_SEPARATOR . $name . '_' . $type . $cli . '.log'; } /**