Commit 1fc63c74 authored by Vidjil Team's avatar Vidjil Team
Browse files

db.py: logging, reverse-ip with prefixes

parent 310ee623
...@@ -249,9 +249,11 @@ class MsgUserAdapter(logging.LoggerAdapter): ...@@ -249,9 +249,11 @@ class MsgUserAdapter(logging.LoggerAdapter):
else: else:
msg = '?' msg = '?'
ip = request.client ip = request.client
if ip in ips: if ip:
ip = "%s/%s" % (ip, ips[ip]) for ip_prefix in ips:
new_msg = '%15s <%s> %s' % (ip, (auth.user.first_name if auth.user else ''), msg) if ip.startswith(ip_prefix):
ip = "%s/%s" % (ip, ips[ip_prefix])
new_msg = '%30s %12s %s' % (ip, ('<%s>' % auth.user.first_name if auth.user else ''), msg)
return new_msg, kwargs return new_msg, kwargs
# #
......
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