Skip to content

Commit 5af188e

Browse files
Revert "ref(logging): New scopes API in LoggingIntegration"
This reverts commit fe09fd9.
1 parent fe09fd9 commit 5af188e

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

sentry_sdk/integrations/logging.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from datetime import datetime, timezone
33
from fnmatch import fnmatch
44

5-
import sentry_sdk
5+
from sentry_sdk.hub import Hub
66
from sentry_sdk.utils import (
77
to_string,
88
event_from_exception,
@@ -101,9 +101,7 @@ 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 = sentry_sdk.get_client().get_integration(
105-
LoggingIntegration
106-
)
104+
integration = Hub.current.get_integration(LoggingIntegration)
107105
if integration is not None:
108106
integration._handle_record(record)
109107

@@ -183,11 +181,11 @@ def _emit(self, record):
183181
if not self._can_record(record):
184182
return
185183

186-
client = sentry_sdk.get_client()
187-
if not client.is_active():
184+
hub = Hub.current
185+
if hub.client is None:
188186
return
189187

190-
client_options = client.options
188+
client_options = hub.client.options
191189

192190
# exc_info might be None or (None, None, None)
193191
#
@@ -252,7 +250,7 @@ def _emit(self, record):
252250

253251
event["extra"] = self._extra_from_record(record)
254252

255-
sentry_sdk.capture_event(event, hint=hint)
253+
hub.capture_event(event, hint=hint)
256254

257255

258256
# Legacy name
@@ -277,7 +275,7 @@ def _emit(self, record):
277275
if not self._can_record(record):
278276
return
279277

280-
sentry_sdk.add_breadcrumb(
278+
Hub.current.add_breadcrumb(
281279
self._breadcrumb_from_record(record), hint={"log_record": record}
282280
)
283281

0 commit comments

Comments
 (0)