加强调试信息

This commit is contained in:
thinkphp
2016-01-27 23:05:46 +08:00
parent cc753a884e
commit 7352655e36
4 changed files with 11 additions and 8 deletions

View File

@@ -23,15 +23,15 @@ class Hook
* @param bool $first 是否放到开头执行
* @return void
*/
public static function add($tag, $behavior,$first=false)
public static function add($tag, $behavior, $first = false)
{
if (!isset(self::$tags[$tag])) {
self::$tags[$tag] = [];
}
if (is_array($behavior)) {
self::$tags[$tag] = array_merge(self::$tags[$tag], $behavior);
} elseif($first){
array_unshift(self::$tags[$tag],$behavior);
} elseif ($first) {
array_unshift(self::$tags[$tag], $behavior);
} else {
self::$tags[$tag][] = $behavior;
}
@@ -101,7 +101,7 @@ class Hook
if (APP_DEBUG) {
Debug::remark('behavior_end', 'time');
Log::record('Run ' . $name . ' [ RunTime:' . Debug::getRangeTime('behavior_start', 'behavior_end') . 's ]', 'log');
Log::record('[ BEHAVIOR ] Run ' . $name . ' @' . $tag . ' [ RunTime:' . Debug::getRangeTime('behavior_start', 'behavior_end') . 's ]', 'log');
}
if (false === $result) {
// 如果返回false 则中断行为执行