修复 socketlog 的bug

This commit is contained in:
upfy@qq.com
2015-12-08 15:30:48 +08:00
parent 31bf125994
commit ed8741629e
4 changed files with 8 additions and 6 deletions

View File

@@ -120,7 +120,7 @@ class Slog
} }
set_error_handler([__CLASS__, 'error_handler']); set_error_handler([__CLASS__, 'error_handler']);
register_shutdown_function([__CLASS__, 'fatalError'])); register_shutdown_function([__CLASS__, 'fatalError']);
} }
public static function error_handler($errno, $errstr, $errfile, $errline) public static function error_handler($errno, $errstr, $errfile, $errline)
@@ -260,7 +260,7 @@ class Slog
} }
//记录日志 //记录日志
public function record($type, $msg = '', $css = '') public static function record($type, $msg = '', $css = '')
{ {
if (!self::check()) { if (!self::check()) {
return; return;
@@ -373,7 +373,7 @@ class Slog
{ {
if (in_array($method, self::$log_types)) { if (in_array($method, self::$log_types)) {
array_unshift($args, $method); array_unshift($args, $method);
return call_user_func_array(self::record, $args); return call_user_func_array(['\org\Slog','record'], $args);
} }
} }

View File

@@ -58,6 +58,7 @@ class App
} }
//判断如果启动SocketLog调试 进行SocketLog配置 //判断如果启动SocketLog调试 进行SocketLog配置
if ($config['slog']['enable']) { if ($config['slog']['enable']) {
define('SLOG_ENABLE',true);
\org\Slog::config($config['slog']); \org\Slog::config($config['slog']);
} }

View File

@@ -70,7 +70,9 @@ class Error
{ {
// 记录日志 // 记录日志
Log::save(); Log::save();
\org\Slog::sendLog(); if(defined('SLOG_ENABLE') && SLOG_ENABLE) {
\org\Slog::sendLog();
}
if ($e = error_get_last()) { if ($e = error_get_last()) {
switch ($e['type']) { switch ($e['type']) {
case E_ERROR: case E_ERROR:

View File

@@ -42,8 +42,7 @@ return [
'think\Url' => CORE_PATH . 'url' . EXT, 'think\Url' => CORE_PATH . 'url' . EXT,
'think\Debug' => CORE_PATH . 'debug' . EXT, 'think\Debug' => CORE_PATH . 'debug' . EXT,
'think\Input' => CORE_PATH . 'input' . EXT, 'think\Input' => CORE_PATH . 'input' . EXT,
'think\Lang' => CORE_PATH . 'lang' . EXT, 'think\Lang' => CORE_PATH . 'lang' . EXT
'think\Slog' => CORE_PATH . 'slog' . EXT
], ],
'init' => [], 'init' => [],