Commit d2188b5e authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

models/db.py, controllers/log.py: some comments

parent 94929684
Pipeline #12067 passed with stages
in 18 seconds
'''
Returns messages previouly logged within the 'user_log' table.
See UserLogHandler() in models/db.py.
'''
import gluon.contrib.simplejson import gluon.contrib.simplejson
if request.env.http_origin: if request.env.http_origin:
......
...@@ -323,6 +323,10 @@ class UserLogHandler(logging.Handler): ...@@ -323,6 +323,10 @@ class UserLogHandler(logging.Handler):
self.table = 'user_log' self.table = 'user_log'
def emit(self, record): def emit(self, record):
'''
When 'user_id' and 'record_id' are defined,
further store the record in the db.
'''
if hasattr(record, 'user_id') and hasattr(record, 'record_id'): if hasattr(record, 'user_id') and hasattr(record, 'record_id'):
from datetime import datetime from datetime import datetime
now = datetime.now() now = datetime.now()
......
Supports Markdown
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