Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion hived/log.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging

from traceback import format_exception
import simplejson as json

from hived import trail
Expand Down Expand Up @@ -27,4 +27,15 @@ def format(self, record):
if trail.get_id():
record_dict['_trail_id'] = trail.get_id()

if record.exc_info:
etype, exc, tb = record.exc_info
record_dict['error'] = {
'etype': etype.__name__,
'exc': exc,
'locals': {k: repr(v)
for k, v in tb.tb_frame.f_locals.iteritems()
if not k.startswith('__')},
'traceback': format_exception(etype, exc, tb),
}

return json.dumps(record_dict, default=json_handler)