From 36a3bdc8752554778fe2a63738d58ea6cd8d8ca4 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 20 May 2016 17:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BHook=E7=B1=BB=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Hook.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/think/Hook.php b/library/think/Hook.php index 0ac83e85..8e6b846c 100644 --- a/library/think/Hook.php +++ b/library/think/Hook.php @@ -101,7 +101,12 @@ class Hook if (APP_DEBUG) { Debug::remark('behavior_end', 'time'); - Log::record('[ BEHAVIOR ] Run ' . ($name instanceof \Closure ? 'Closure' : $name) . ' @' . $tag . ' [ RunTime:' . Debug::getRangeTime('behavior_start', 'behavior_end') . 's ]', 'info'); + if ($name instanceof \Closure) { + $name = 'Closure'; + } elseif (is_object($name)) { + $name = get_class($name); + } + Log::record('[ BEHAVIOR ] Run ' . $name . ' @' . $tag . ' [ RunTime:' . Debug::getRangeTime('behavior_start', 'behavior_end') . 's ]', 'info'); } if (false === $result) { // 如果返回false 则中断行为执行