Skip to content

Commit

Permalink
Remove a try-except block dedicated to python2 in the implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jaris committed Oct 22, 2022
1 parent e15b213 commit 97ab7f8
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/pythonjsonlogger/jsonlogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,10 @@ def format(self, record: logging.LogRecord) -> str:
message_dict['exc_info'] = record.exc_text
# Display formatted record of stack frames
# default format is a string returned from :func:`traceback.print_stack`
try:
if record.stack_info and not message_dict.get('stack_info'):
message_dict['stack_info'] = self.formatStack(record.stack_info)
except AttributeError:
# Python2.7 doesn't have stack_info.
pass

log_record: Dict[str, Any]
log_record = OrderedDict()
if record.stack_info and not message_dict.get('stack_info'):
message_dict['stack_info'] = self.formatStack(record.stack_info)

log_record: Dict[str, Any] = OrderedDict()
self.add_fields(log_record, record, message_dict)
log_record = self.process_log_record(log_record)

Expand Down

0 comments on commit 97ab7f8

Please sign in to comment.