改进Hook类的日志记录

This commit is contained in:
thinkphp
2016-05-20 17:13:27 +08:00
parent a24a2155eb
commit 36a3bdc875

View File

@@ -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 则中断行为执行