Commit a7bc4caa authored by wanjilong's avatar wanjilong

add: 增加日志关闭info 方法

parent 44566393
...@@ -8,6 +8,7 @@ use Api\PhpUtils\Message\Email; ...@@ -8,6 +8,7 @@ use Api\PhpUtils\Message\Email;
class FileLog class FileLog
{ {
static private $log = true;
const PREFIX_FILELOG_ERROR = 'flerr:'; const PREFIX_FILELOG_ERROR = 'flerr:';
/** /**
* 用于记录info级别的错误 * 用于记录info级别的错误
...@@ -18,6 +19,10 @@ class FileLog ...@@ -18,6 +19,10 @@ class FileLog
*/ */
public static function info($signature, $detail_info = '', $with_access_log = false) public static function info($signature, $detail_info = '', $with_access_log = false)
{ {
if(self::$log == false) {
return true;
}
$traceId = Tracer::getTraceId(); $traceId = Tracer::getTraceId();
$log = 'PHP User_info: [' . $signature . '] [traceId:'. $traceId .'] [detail info:] ' . $detail_info; $log = 'PHP User_info: [' . $signature . '] [traceId:'. $traceId .'] [detail info:] ' . $detail_info;
if ($with_access_log) { if ($with_access_log) {
...@@ -26,6 +31,10 @@ class FileLog ...@@ -26,6 +31,10 @@ class FileLog
error_log($log); error_log($log);
} }
public static function closeInfo(bool $flag) {
self::$log = $flag;
}
/** /**
* 用于记录waring级别的错误,在日志分析时此级别日志会使用signature进行聚合 * 用于记录waring级别的错误,在日志分析时此级别日志会使用signature进行聚合
* 会记录请求上下文,不会发生报警邮件 * 会记录请求上下文,不会发生报警邮件
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment