8000 Remove a try-except block dedicated to python2 in the implementation · madzak/python-json-logger@97ab7f8 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Commit 97ab7f8

Browse files
committed
Remove a try-except block dedicated to python2 in the implementation
1 parent e15b213 commit 97ab7f8

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/pythonjsonlogger/jsonlogger.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,10 @@ def format(self, record: logging.LogRecord) -> str:
221221
message_dict['exc_info'] = record.exc_text
222222
# Display formatted record of stack frames
223223
# default format is a string returned from :func:`traceback.print_stack`
224-
try:
225-
if record.stack_info and not message_dict.get('stack_info'):
226-
message_dict['stack_info'] = self.formatStack(record.stack_info)
227-
except AttributeError:
228-
# Python2.7 doesn't have stack_info.
229-
pass
230-
231-
log_record: Dict[str, Any]
232-
log_record = OrderedDict()
224+
if record.stack_info and not message_dict.get('stack_info'):
225+
message_dict['stack_info'] = self.formatStack(record.stack_info)
226+
227+
log_record: Dict[str, Any] = OrderedDict()
233228
self.add_fields(log_record, record, message_dict)
234229
log_record = self.process_log_record(log_record)
235230

0 commit comments

Comments
 (0)
0