Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
php_utils
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
php_utils
Commits
a7bc4caa
Commit
a7bc4caa
authored
Sep 01, 2021
by
wanjilong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 增加日志关闭info 方法
parent
44566393
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
FileLog.php
src/Log/FileLog.php
+9
-0
No files found.
src/Log/FileLog.php
View file @
a7bc4caa
...
@@ -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进行聚合
* 会记录请求上下文,不会发生报警邮件
* 会记录请求上下文,不会发生报警邮件
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment