From c0e691871148c2da3bb5d3371d9792ed401ecb12 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 5 Feb 2016 12:14:57 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2trace=E8=AE=B0=E5=BD=95=20?= =?UTF-8?q?=E5=8F=AA=E5=9C=A8=20'default=5Freturn=5Ftype'=20=3D=3D=20'html?= =?UTF-8?q?'=20=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/log/driver/Trace.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/library/think/log/driver/Trace.php b/library/think/log/driver/Trace.php index 7cc3c182..7b4f5b73 100644 --- a/library/think/log/driver/Trace.php +++ b/library/think/log/driver/Trace.php @@ -10,6 +10,9 @@ // +---------------------------------------------------------------------- namespace think\log\driver; +use think\Config; +use think\Debug; + /** * 页面Trace调试 需要设置 'response_exit' => false 才能生效 */ @@ -35,7 +38,7 @@ class Trace */ public function save(array $log = []) { - if (IS_AJAX || IS_CLI || IS_API) { + if (IS_AJAX || IS_CLI || IS_API || 'html' != Config::get('default_return_type')) { // ajax cli api方式下不输出 return; } @@ -50,11 +53,11 @@ class Trace '运行时间' => "{$runtime}s [ 吞吐率:{$reqs}req/s ] 内存消耗:{$mem}kb 文件加载:" . count(get_included_files()), '查询信息' => \think\Db::$queryTimes . ' queries ' . \think\Db::$executeTimes . ' writes ', '缓存信息' => \think\Cache::$readTimes . ' reads,' . \think\Cache::$writeTimes . ' writes', - '配置加载' => count(\think\Config::get()), + '配置加载' => count(Config::get()), '会话信息' => 'SESSION_ID=' . session_id(), ]; - $info = \think\Debug::getFile(true); + $info = Debug::getFile(true); // 获取调试日志 $debug = []; @@ -67,13 +70,13 @@ class Trace foreach ($this->tabs as $name => $title) { $name = strtolower($name); switch ($name) { - case 'base': // 基本信息 + case 'base': // 基本信息 $trace[$title] = $base; break; - case 'file': // 文件信息 + case 'file': // 文件信息 $trace[$title] = $info; break; - default: // 调试信息 + default: // 调试信息 if (strpos($name, '|')) { // 多组信息 $names = explode('|', $name);