22from datetime import datetime , timezone
33from fnmatch import fnmatch
44
5- from sentry_sdk . hub import Hub
5+ import sentry_sdk
66from sentry_sdk .utils import (
77 to_string ,
88 event_from_exception ,
@@ -101,7 +101,9 @@ def sentry_patched_callhandlers(self, record):
101101 # into a recursion error when the integration is resolved
102102 # (this also is slower).
103103 if ignored_loggers is not None and record .name not in ignored_loggers :
104- integration = Hub .current .get_integration (LoggingIntegration )
104+ integration = sentry_sdk .get_client ().get_integration (
105+ LoggingIntegration
106+ )
105107 if integration is not None :
106108 integration ._handle_record (record )
107109
@@ -181,11 +183,11 @@ def _emit(self, record):
181183 if not self ._can_record (record ):
182184 return
183185
184- hub = Hub . current
185- if hub . client is None :
186+ client = sentry_sdk . get_client ()
187+ if not client . is_active () :
186188 return
187189
188- client_options = hub . client .options
190+ client_options = client .options
189191
190192 # exc_info might be None or (None, None, None)
191193 #
@@ -250,7 +252,7 @@ def _emit(self, record):
250252
251253 event ["extra" ] = self ._extra_from_record (record )
252254
253- hub .capture_event (event , hint = hint )
255+ sentry_sdk .capture_event (event , hint = hint )
254256
255257
256258# Legacy name
@@ -275,7 +277,7 @@ def _emit(self, record):
275277 if not self ._can_record (record ):
276278 return
277279
278- Hub . current .add_breadcrumb (
280+ sentry_sdk .add_breadcrumb (
279281 self ._breadcrumb_from_record (record ), hint = {"log_record" : record }
280282 )
281283
0 commit comments