Permalink
Browse files

Merge pull request #9 from deanq/master

Fix the KeyError on formatter
  • Loading branch information...
2 parents 99512c8 + 077aea2 commit c20c817385a99f944612b533fb7c86fa553f5119 @madzak committed May 25, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/jsonlogger.py
View
@@ -94,10 +94,10 @@ def format(self, record):
log_record = {}
for field in self._required_fields:
- log_record[field] = record.__dict__[field]
+ log_record[field] = record.__dict__.get(field)
log_record.update(extras)
merge_record_extra(record, log_record, reserved=self._skip_fields)
return json.dumps(log_record,
default=self.json_default,
- cls=self.json_encoder)
+ cls=self.json_encoder)

0 comments on commit c20c817

Please sign in to comment.