mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
封装trace方法用于远程调试输出
This commit is contained in:
12
base.php
12
base.php
@@ -305,3 +305,15 @@ function S($name, $value = '', $options = null)
|
|||||||
return $cache->set($name, $value, $expire);
|
return $cache->set($name, $value, $expire);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加Trace记录到SocketLog
|
||||||
|
* @param mixed $log log信息 支持字符串和数组
|
||||||
|
* @param string $level 日志级别
|
||||||
|
* @param string $css 样式
|
||||||
|
* @return void|array
|
||||||
|
*/
|
||||||
|
function trace($log,$level='log',$css='')
|
||||||
|
{
|
||||||
|
return think\Slog::record($level,$log,$css);
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ class Slog
|
|||||||
public static $start_time = 0;
|
public static $start_time = 0;
|
||||||
public static $start_memory = 0;
|
public static $start_memory = 0;
|
||||||
public static $port = 1116; //SocketLog 服务的http的端口号
|
public static $port = 1116; //SocketLog 服务的http的端口号
|
||||||
public static $log_types = ['log', 'info', 'error', 'warn', 'table', 'group', 'groupCollapsed', 'groupEnd', 'alert'];
|
public static $log_types = ['log', 'info', 'error', 'warn', 'table', 'alert'];
|
||||||
|
|
||||||
protected static $config = [
|
protected static $config = [
|
||||||
'enable' => true, //是否记录日志的开关
|
'enable' => true, //是否记录日志的开关
|
||||||
@@ -70,7 +70,7 @@ class Slog
|
|||||||
if (!self::check()) {
|
if (!self::check()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
self::groupCollapsed($msg, $css);
|
self::record('groupCollapsed', $msg, $css);
|
||||||
$traces = debug_backtrace(false);
|
$traces = debug_backtrace(false);
|
||||||
$traces = array_reverse($traces);
|
$traces = array_reverse($traces);
|
||||||
$max = count($traces) - $trace_level;
|
$max = count($traces) - $trace_level;
|
||||||
|
|||||||
Reference in New Issue
Block a user