import sys import logging from sentry_sdk import utils from sentry_sdk.hub import Hub from sentry_sdk.utils import logger from sentry_sdk.client import _client_init_debug from logging import LogRecord class _HubBasedClientFilter(logging.Filter): def filter(self, record): # type: (LogRecord) -> bool if _client_init_debug.get(False): return True hub = Hub.current if hub is not None and hub.client is not None: return hub.client.options["debug"] return False def init_debug_support(): # type: () -> None if not logger.handlers: configure_logger() configure_debug_hub() def configure_logger(): # type: () -> None _handler = logging.StreamHandler(sys.stderr) _handler.setFormatter(logging.Formatter(" [sentry] %(levelname)s: %(message)s")) logger.addHandler(_handler) logger.setLevel(logging.DEBUG) logger.addFilter(_HubBasedClientFilter()) def configure_debug_hub(): # type: () -> None def _get_debug_hub(): # type: () -> Hub return Hub.current utils._get_debug_hub = _get_debug_hub
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
integrations | Folder | 0755 |
|
|
__init__.py | File | 854 B | 0644 |
|
_compat.py | File | 2.3 KB | 0644 |
|
_functools.py | File | 2.22 KB | 0644 |
|
_queue.py | File | 8.21 KB | 0644 |
|
_types.py | File | 1.26 KB | 0644 |
|
api.py | File | 4.69 KB | 0644 |
|
attachments.py | File | 1.75 KB | 0644 |
|
client.py | File | 14.03 KB | 0644 |
|
consts.py | File | 3.5 KB | 0644 |
|
debug.py | File | 1.11 KB | 0644 |
|
envelope.py | File | 8.17 KB | 0644 |
|
hub.py | File | 21.35 KB | 0644 |
|
py.typed | File | 0 B | 0644 |
|
scope.py | File | 15.62 KB | 0644 |
|
serializer.py | File | 15.92 KB | 0644 |
|
sessions.py | File | 7.67 KB | 0644 |
|
tracing.py | File | 25.24 KB | 0644 |
|
transport.py | File | 11.48 KB | 0644 |
|
utils.py | File | 26.26 KB | 0644 |
|
worker.py | File | 3.87 KB | 0644 |
|