diff --git a/library/think/Log.php b/library/think/Log.php index 65c2cd4c..76474c21 100644 --- a/library/think/Log.php +++ b/library/think/Log.php @@ -80,9 +80,6 @@ class Log */ public static function record($msg, $type = 'log') { - if (!is_string($msg)) { - $msg = var_export($msg, true); - } self::$log[$type][] = $msg; } @@ -153,9 +150,6 @@ class Log */ public static function write($msg, $type = 'log') { - if (!is_string($msg)) { - $msg = var_export($msg, true); - } // 封装日志信息 $log[$type][] = $msg; diff --git a/library/think/log/driver/File.php b/library/think/log/driver/File.php index 62cb9827..81053045 100644 --- a/library/think/log/driver/File.php +++ b/library/think/log/driver/File.php @@ -65,6 +65,9 @@ class File $info = '[ log ] ' . $current_uri . $time_str . $memory_str . $file_load . "\r\n"; foreach ($log as $type => $val) { foreach ($val as $msg) { + if (!is_string($msg)) { + $msg = var_export($msg, true); + } $info .= '[ ' . $type . ' ] ' . $msg . "\r\n"; } } diff --git a/library/think/log/driver/Sae.php b/library/think/log/driver/Sae.php index 036245dd..d9ca44fe 100644 --- a/library/think/log/driver/Sae.php +++ b/library/think/log/driver/Sae.php @@ -44,6 +44,9 @@ class Sae $info = '[ log ] ' . $current_uri . $time_str . $memory_str . $file_load . "\r\n"; foreach ($log as $type => $val) { foreach ($val as $msg) { + if (!is_string($msg)) { + $msg = var_export($msg, true); + } $info .= '[ ' . $type . ' ] ' . $msg . "\r\n"; } } diff --git a/library/think/log/driver/Socket.php b/library/think/log/driver/Socket.php index a4942a9c..a6a666f4 100644 --- a/library/think/log/driver/Socket.php +++ b/library/think/log/driver/Socket.php @@ -92,6 +92,9 @@ class Socket 'css' => isset($this->css[$type]) ? $this->css[$type] : '', ]; foreach ($val as $msg) { + if (!is_string($msg)) { + $msg = var_export($msg, true); + } $trace[] = [ 'type' => 'log', 'msg' => $msg, diff --git a/library/think/log/driver/Trace.php b/library/think/log/driver/Trace.php index 3471f92b..824b1639 100644 --- a/library/think/log/driver/Trace.php +++ b/library/think/log/driver/Trace.php @@ -72,6 +72,9 @@ class Trace $debug = []; foreach ($log as $type => $val) { foreach ($val as $msg) { + if (!is_string($msg)) { + $msg = var_export($msg, true); + } $debug[$type][] = $msg; } }