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(): if not logger.handlers: configure_logger() configure_debug_hub() def configure_logger(): _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(): def _get_debug_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 | 1.4 KB | 0644 |
|
_compat.py | File | 2.17 KB | 0644 |
|
api.py | File | 2.82 KB | 0644 |
|
client.py | File | 8.4 KB | 0644 |
|
consts.py | File | 2.21 KB | 0644 |
|
debug.py | File | 1.01 KB | 0644 |
|
hub.py | File | 12.72 KB | 0644 |
|
scope.py | File | 7.02 KB | 0644 |
|
transport.py | File | 6.79 KB | 0644 |
|
utils.py | File | 26.92 KB | 0644 |
|
worker.py | File | 3.47 KB | 0644 |
|