Skip to content

Commit

Permalink
check for presence of LogRecord.processName before trying to get it
Browse files Browse the repository at this point in the history
It was added in Python 2.6.2.
  • Loading branch information
joeshaw committed Sep 12, 2011
1 parent 35b7db6 commit 3b9655e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions graypy/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_full_message(self, exc_info):
return traceback.format_exc(exc_info) if exc_info else ''

def make_message_dict(self, record):
return {
d = {
'version': self.version,
'host': self.hostname,
'short_message': record.getMessage(),
Expand All @@ -54,9 +54,12 @@ def make_message_dict(self, record):
'line': record.lineno,
'_function': record.funcName,
'_pid': record.process,
'_process_name': record.processName,
'_thread_name': record.threadName,
}
# record.processName was added in Python 2.6.2
if hasattr(record, 'processName'):
d['_process_name'] = record.processName
return d


class ChunkedGELF(object):
Expand Down

0 comments on commit 3b9655e

Please sign in to comment.