PHP 8.2.30
Preview: debug.py Size: 1.01 KB
//opt/alt/python38/lib/python3.8/site-packages/sentry_sdk/debug.py

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

Directory Contents

Dirs: 2 × Files: 11

Name Size Perms Modified Actions
- drwxr-xr-x 2024-03-21 10:24:45
Edit Download
- drwxr-xr-x 2024-03-21 10:24:45
Edit Download
2.82 KB lrw-r--r-- 2019-04-05 23:15:16
Edit Download
8.40 KB lrw-r--r-- 2019-04-05 23:15:16
Edit Download
2.21 KB lrw-r--r-- 2019-04-05 23:15:16
Edit Download
1.01 KB lrw-r--r-- 2019-04-05 23:15:16
Edit Download
12.72 KB lrw-r--r-- 2019-04-05 23:15:16
Edit Download
7.02 KB lrw-r--r-- 2019-04-05 23:15:16
Edit Download
6.79 KB lrw-r--r-- 2019-04-05 23:15:16
Edit Download
26.92 KB lrw-r--r-- 2019-04-05 23:15:16
Edit Download
3.47 KB lrw-r--r-- 2019-04-05 23:15:16
Edit Download
2.17 KB lrw-r--r-- 2019-04-05 23:15:16
Edit Download
1.40 KB lrw-r--r-- 2019-04-05 23:15:16
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).