Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
saturn
Project
Project
Details
Activity
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
赵磊
saturn
Commits
68c2e26f
Commit
68c2e26f
authored
Dec 29, 2018
by
zhanglu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加敏感词日志
parent
db6692de
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
sensitive.py
api/utils/sensitive.py
+4
-0
logger.py
engine/logger.py
+2
-0
log_settings.py
settings/log_settings.py
+12
-0
No files found.
api/utils/sensitive.py
View file @
68c2e26f
...
...
@@ -2,6 +2,7 @@
from
engine.rpc
import
get_current_rpc_invoker
from
engine.logger
import
sensitive_logger
from
libs.spawn_task
import
SpawnTask
,
Task
...
...
@@ -41,6 +42,9 @@ class Sensitive(object):
except
:
res
=
None
sensitive_logger
.
info
(
text
)
sensitive_logger
.
info
(
res
)
return
res
@classmethod
...
...
engine/logger.py
View file @
68c2e26f
...
...
@@ -27,6 +27,8 @@ exception_logger = logging.getLogger('exception_logger')
cpc_click_consumer_logger
=
logging
.
getLogger
(
'cpc_click_consumer_logger'
)
auth_logger
=
logging
.
getLogger
(
'auth_logger'
)
wechat_logger
=
logging
.
getLogger
(
'wechat_logger'
)
sensitive_logger
=
logging
.
getLogger
(
'sensitive_logger'
)
def
debug
(
view_func
):
"""将POST请求数据存到log
...
...
settings/log_settings.py
View file @
68c2e26f
...
...
@@ -92,6 +92,13 @@ LOGGING = {
'interval'
:
1
,
'backupCount'
:
30
,
},
'sensitive_handler'
:
{
'level'
:
'INFO'
,
'class'
:
'logging.handlers.RotatingFileHandler'
,
'filename'
:
os
.
path
.
join
(
LOG_DIR
,
'sensitive.log'
),
'formatter'
:
'profile'
,
'maxBytes'
:
500
*
1024
*
1024
,
# 500M
},
},
'loggers'
:
{
...
...
@@ -143,6 +150,11 @@ LOGGING = {
'propagate'
:
False
,
'level'
:
'INFO'
},
'sensitive_logger'
:
{
'handlers'
:
[
'sensitive_handler'
],
'propagate'
:
False
,
'level'
:
'INFO'
},
}
}
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