Avoid extracting the stack twice in system_log (#112572)

This commit is contained in:
J. Nick Koston 2024-03-07 06:00:05 -10:00 committed by GitHub
parent 1b824a4fea
commit 70a3f67e03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -180,8 +180,8 @@ class LogEntry:
self.exception = "".join(traceback.format_exception(*record.exc_info)) self.exception = "".join(traceback.format_exception(*record.exc_info))
_, _, tb = record.exc_info _, _, tb = record.exc_info
# Last line of traceback contains the root cause of the exception # Last line of traceback contains the root cause of the exception
if traceback.extract_tb(tb): if extracted := traceback.extract_tb(tb):
self.root_cause = str(traceback.extract_tb(tb)[-1]) self.root_cause = str(extracted[-1])
self.source = source self.source = source
self.count = 1 self.count = 1
self.key = (self.name, source, self.root_cause) self.key = (self.name, source, self.root_cause)