8000 fix(logging): An error should not have its own breadcrumb (#182) · etherscan-io/sentry-python@39b9438 · GitHub
[go: up one dir, main page]

Skip to content

Commit 39b9438

Browse files
authored
fix(logging): An error should not have its own breadcrumb (getsentry#182)
1 parent 30d6a38 commit 39b9438

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

sentry_sdk/integrations/logging.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,17 @@ def setup_once():
5454
old_callhandlers = logging.Logger.callHandlers
5555

5656
def sentry_patched_callhandlers(self, record):
57-
# This check is done twice, once also here before we even get
58-
# the integration. Otherwise we have a high chance of getting
59-
# into a recursion error when the integration is resolved
60-
# (this also is slower).
61-
if record.name not in _IGNORED_LOGGERS:
62-
integration = Hub.current.get_integration(LoggingIntegration)
63-
if integration is not None:
64-
integration._handle_record(record)
65-
return old_callhandlers(self, record)
57+
try:
58+
return old_callhandlers(self, record)
59+
finally:
60+
# This check is done twice, once also here before we even get
61+
# the integration. Otherwise we have a high chance of getting
62+
# into a recursion error when the integration is resolved
63+
# (this also is slower).
64+
if record.name not in _IGNORED_LOGGERS:
65+
integration = Hub.current.get_integration(LoggingIntegration)
66+
if integration is not None:
67+
integration._handle_record(record)
6668

6769
logging.Logger.callHandlers = sentry_patched_callhandlers
6870

0 commit comments

Comments
 (0)
0