This commit is contained in:
thinkphp
2015-12-08 13:13:17 +08:00
parent 931986143f
commit 31bf125994

View File

@@ -37,9 +37,9 @@ class Slog
'big' => 'font-size:20px;color:red;', 'big' => 'font-size:20px;color:red;',
]; ];
public static function sql($sql, $link) public static function sql($sql, $pdo)
{ {
if (is_object($link)) { if (is_object($pdo)) {
if (!self::check()) { if (!self::check()) {
return; return;
} }
@@ -187,18 +187,18 @@ class Slog
protected static function check() protected static function check()
{ {
if (!self::getConfig('enable')) { if (!self::$config['enable']) {
return false; return false;
} }
$tabid = self::getClientArg('tabid'); $tabid = self::getClientArg('tabid');
//是否记录日志的检查 //是否记录日志的检查
if (!$tabid && !self::getConfig('force_client_id')) { if (!$tabid && !self::$config['force_client_id']) {
return false; return false;
} }
//用户认证 //用户认证
$allow_client_ids = self::getConfig('allow_client_ids'); $allow_client_ids = self::$config['allow_client_ids'];
if (!empty($allow_client_ids)) { if (!empty($allow_client_ids)) {
if (!$tabid && in_array(self::getConfig('force_client_id'), $allow_client_ids)) { if (!$tabid && in_array(self::$config['force_client_id'], $allow_client_ids)) {
return true; return true;
} }
@@ -326,7 +326,7 @@ class Slog
'css' => self::$css['page'], 'css' => self::$css['page'],
]); ]);
if (self::getConfig('show_included_files')) { if (self::$config['show_included_files']) {
self::$logs[] = [ self::$logs[] = [
'type' => 'groupCollapsed', 'type' => 'groupCollapsed',
'msg' => 'included_files', 'msg' => 'included_files',
@@ -354,7 +354,7 @@ class Slog
if (!$client_id = self::getClientArg('client_id')) { if (!$client_id = self::getClientArg('client_id')) {
$client_id = ''; $client_id = '';
} }
if ($force_client_id = self::getConfig('force_client_id')) { if ($force_client_id = self::$config['force_client_id']) {
$client_id = $force_client_id; $client_id = $force_client_id;
} }
$logs = [ $logs = [
@@ -365,7 +365,7 @@ class Slog
]; ];
$msg = @json_encode($logs); $msg = @json_encode($logs);
$address = '/' . $client_id; //将client_id作为地址 server端通过地址判断将日志发布给谁 $address = '/' . $client_id; //将client_id作为地址 server端通过地址判断将日志发布给谁
self::send(self::getConfig('host'), $msg, $address); self::send(self::$config['host'], $msg, $address);
} }