Skip to content

Commit

Permalink
Log exc type when logging exc.
Browse files Browse the repository at this point in the history
  • Loading branch information
alenz33 committed Mar 20, 2015
1 parent 9fb8a7c commit 096697f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions conduct/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@ def format(self, record):
fmtstr = self.colorize('fuchsia', '%s%%(levelname)s: %%(message)s'
% namefmt)
else:
fmtstr = self.colorize('red', '%s%%(levelname)s: %%(message)s'
% namefmt)
# Add exception type to error (if caused by exception)
msgPrefix = ''
if record.exc_info:
msgPrefix = '%s: ' % record.exc_info[0].__name__

fmtstr = self.colorize('red', '%s%%(levelname)s: %s%%(message)s'
% (namefmt, msgPrefix))
fmtstr = datefmt + fmtstr
if not getattr(record, 'nonl', False):
fmtstr += '\n'
Expand Down

0 comments on commit 096697f

Please sign in to comment.