8000 Prevent global var from being discarded at shutdown (#2530) · getsentry/sentry-python@4e9d661 · GitHub
[go: up one dir, main page]

Skip to content< 8000 /a>

Commit 4e9d661

Browse files
authored
Prevent global var from being discarded at shutdown (#2530)
1 parent a67914c commit 4e9d661

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sentry_sdk/integrations/logging.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,18 @@ def setup_once():
9191

9292 8000
def sentry_patched_callhandlers(self, record):
9393
# type: (Any, LogRecord) -> Any
94+
# keeping a local reference because the
95+
# global might be discarded on shutdown
96+
ignored_loggers = _IGNORED_LOGGERS
97+
9498
try:
9599
return old_callhandlers(self, record)
96100
finally:
97101
# This check is done twice, once also here before we even get
98102
# the integration. Otherwise we have a high chance of getting
99103
# into a recursion error when the integration is resolved
100104
# (this also is slower).
101-
if record.name not in _IGNORED_LOGGERS:
105+
if ignored_loggers is not None and record.name not in ignored_loggers:
102106
integration = Hub.current.get_integration(LoggingIntegration)
103107
if integration is not None:
104108
integration._handle_record(record)

0 commit comments

Comments
 (0)
0