添加执行信息日志

This commit is contained in:
thinkphp
2016-01-27 17:56:47 +08:00
parent 9903717cc4
commit 3c9c93c6b8
2 changed files with 9 additions and 1 deletions

View File

@@ -78,7 +78,8 @@ class App
// 未指定调度类型 则进行URL路由检测 // 未指定调度类型 则进行URL路由检测
self::route($config); self::route($config);
} }
// 记录调度信息
Log::record('[ DISPATCH ] ' . var_export(self::$dispatch, true), 'info');
// 监听app_begin // 监听app_begin
APP_HOOK && Hook::listen('app_begin'); APP_HOOK && Hook::listen('app_begin');
@@ -118,6 +119,8 @@ class App
{ {
$reflect = new \ReflectionFunction($function); $reflect = new \ReflectionFunction($function);
$args = self::bindParams($reflect, $vars); $args = self::bindParams($reflect, $vars);
// 记录执行信息
Log::record('[ RUN ] ' . $reflect->getFileName(), 'info');
return $reflect->invokeArgs($args); return $reflect->invokeArgs($args);
} }
@@ -145,6 +148,8 @@ class App
$reflect = new \ReflectionMethod($method); $reflect = new \ReflectionMethod($method);
} }
$args = self::bindParams($reflect, $vars); $args = self::bindParams($reflect, $vars);
// 记录执行信息
Log::record('[ RUN ] ' . $reflect->getFileName(), 'info');
return $reflect->invokeArgs(isset($class) ? $class : null, $args); return $reflect->invokeArgs(isset($class) ? $class : null, $args);
} }
@@ -243,6 +248,7 @@ class App
if (method_exists($instance, '_empty')) { if (method_exists($instance, '_empty')) {
$method = new \ReflectionMethod($instance, '_empty'); $method = new \ReflectionMethod($instance, '_empty');
$data = $method->invokeArgs($instance, [$action, '']); $data = $method->invokeArgs($instance, [$action, '']);
Log::record('[ RUN ] ' . $method->getFileName(), 'info');
} else { } else {
throw new Exception('method [ ' . (new \ReflectionClass($instance))->getName() . '->' . $action . ' ] not exists ', 10002); throw new Exception('method [ ' . (new \ReflectionClass($instance))->getName() . '->' . $action . ' ] not exists ', 10002);
} }

View File

@@ -346,6 +346,8 @@ class Loader
parse_str($vars, $vars); parse_str($vars, $vars);
} }
$method = new \ReflectionMethod($class, $action . Config::get('action_suffix')); $method = new \ReflectionMethod($class, $action . Config::get('action_suffix'));
// 记录执行信息
Log::record('[ RUN ] ' . $method->getFileName(), 'info');
return $method->invokeArgs($class, $vars); return $method->invokeArgs($class, $vars);
} }
} }