Skip to content

horde_logging

verbosity module-attribute

verbosity = 17

error_levels module-attribute

error_levels = ['ERROR', 'CRITICAL', 'EXCEPTION', 'TRACE']

handler_config module-attribute

handler_config = [{'sink': stdout, 'colorize': True, 'filter': is_stdout_log}, {'sink': 'logs/bridge.log', 'level': 'DEBUG', 'colorize': False, 'retention': '2 days', 'rotation': '3 hours'}, {'sink': 'logs/trace.log', 'level': 'TRACE', 'colorize': False, 'filter': is_trace_log, 'retention': '3 days', 'rotation': '1 days', 'backtrace': True, 'diagnose': True}]

PROGRESS_LOGGER_LABEL module-attribute

PROGRESS_LOGGER_LABEL = 'PROGRESS'

The label for request progress log messages. Less severity than INFO.

COMPLETE_LOGGER_LABEL module-attribute

COMPLETE_LOGGER_LABEL = 'COMPLETE'

The label for 'request complete' log messages. Less severity than INFO.

HORDE_SDK_LOG_VERBOSITY module-attribute

HORDE_SDK_LOG_VERBOSITY = getenv('HORDE_SDK_LOG_VERBOSITY')

parsed_verbosity module-attribute

parsed_verbosity: int | None = int(HORDE_SDK_LOG_VERBOSITY)

set_logger_handlers module-attribute

set_logger_handlers = getenv('HORDE_SDK_SET_DEFAULT_LOG_HANDLERS')

set_logger_verbosity

set_logger_verbosity(count: int) -> None

Set the verbosity of the logger.

Source code in horde_sdk/horde_logging.py
def set_logger_verbosity(count: int) -> None:
    """Set the verbosity of the logger."""
    global verbosity
    # The count comes reversed. So count = 0 means minimum verbosity
    # While count 5 means maximum verbosity
    # So the more count we have, the lowe we drop the versbosity maximum
    verbosity = 20 - (count * 10)

is_stdout_log

is_stdout_log(record: dict[str, Any]) -> bool

Filter for stdout logs levels.

Source code in horde_sdk/horde_logging.py
def is_stdout_log(record: dict[str, Any]) -> bool:
    """Filter for stdout logs levels."""
    return not record["level"].no < verbosity

is_msg_log

is_msg_log(record: dict[str, Any]) -> bool

Filter for stdout logs levels.

Source code in horde_sdk/horde_logging.py
def is_msg_log(record: dict[str, Any]) -> bool:
    """Filter for stdout logs levels."""
    return not record["level"].no < verbosity

is_stderr_log

is_stderr_log(record: dict[str, Any]) -> bool

Filter for stderr logs levels.

Source code in horde_sdk/horde_logging.py
def is_stderr_log(record: dict[str, Any]) -> bool:
    """Filter for stderr logs levels."""
    return not record["level"].name not in error_levels

is_trace_log

is_trace_log(record: dict[str, Any]) -> bool

Filter for trace logs levels.

Source code in horde_sdk/horde_logging.py
def is_trace_log(record: dict[str, Any]) -> bool:
    """Filter for trace logs levels."""
    return not record["level"].name not in error_levels