Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
ValUnifer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IPIPAN
ValUnifer
Commits
a5e7d08c
Commit
a5e7d08c
authored
1 year ago
by
dcz
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'remotes/github/pre_freelu_horizontal_rel_bugfix'
parents
5e83adcb
fdfdb39e
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
shellvalier/settings.py
+1
-0
1 addition, 0 deletions
shellvalier/settings.py
syntax/middleware.py
+28
-0
28 additions, 0 deletions
syntax/middleware.py
with
29 additions
and
0 deletions
shellvalier/settings.py
+
1
−
0
View file @
a5e7d08c
...
...
@@ -82,6 +82,7 @@ MIDDLEWARE = [
'
django.contrib.auth.middleware.AuthenticationMiddleware
'
,
'
django.contrib.messages.middleware.MessageMiddleware
'
,
'
django.middleware.clickjacking.XFrameOptionsMiddleware
'
,
'
syntax.middleware.SessionLogMiddleware
'
,
'
django.middleware.locale.LocaleMiddleware
'
,
]
...
...
This diff is collapsed.
Click to expand it.
syntax/middleware.py
0 → 100644
+
28
−
0
View file @
a5e7d08c
import
json
import
logging
import
traceback
from
django.http
import
Http404
from
django.http.request
import
RawPostDataException
from
django.utils.deprecation
import
MiddlewareMixin
# if you want to track it
# from sentry_sdk import capture_exception
class
SessionLogMiddleware
(
MiddlewareMixin
):
"""
this middleware to create a log
by current user
"""
def
process_exception
(
self
,
request
,
exception
):
try
:
print
(
"
Exception, user-id={}, user-name={}, path={}, post={}, get={}
"
.
format
(
request
.
user
.
id
,
request
.
user
.
username
,
request
.
path
,
request
.
POST
,
request
.
GET
))
except
Exception
as
error
:
print
(
error
)
return
# no return anything
def
process_response
(
self
,
request
,
response
):
print
(
"
user: id={}, name={}, path={}, post={}, get={}
"
.
format
(
request
.
user
.
id
,
request
.
user
.
username
,
request
.
path
,
request
.
POST
,
request
.
GET
))
return
response
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment