Skip to content

debug_utils

Centralized debug configuration for the application.

This module provides a single place to enable/disable debug logging for different components without removing debug statements from code.

Usage

from core.debug_utils import debug

if debug.year: logger.info("Year processing details: %s", data)

if debug.api: logger.info("API response: %s", response)

DebugConfig dataclass

DebugConfig(
    year=False,
    api=False,
    cache=False,
    applescript=False,
    pipeline=False,
)

Centralized debug configuration.

All debug flags are False by default. Enable specific flags when you need detailed logging for troubleshooting.

Attributes:

Name Type Description
year bool

Debug year retrieval and processing logic

api bool

Debug external API calls and responses

cache bool

Debug cache operations (hits, misses, invalidation)

applescript bool

Debug AppleScript execution

pipeline bool

Debug main processing pipeline flow

Environment Variables

DEBUG_ALL: Enable all debug flags (set to "1" or "true") DEBUG_YEAR: Enable year debug (set to "1" or "true") DEBUG_API: Enable API debug (set to "1" or "true") DEBUG_CACHE: Enable cache debug (set to "1" or "true") DEBUG_APPLESCRIPT: Enable AppleScript debug (set to "1" or "true") DEBUG_PIPELINE: Enable pipeline debug (set to "1" or "true")

__post_init__

__post_init__()

Load debug flags from environment variables.

Source code in src/core/debug_utils.py
def __post_init__(self) -> None:
    """Load debug flags from environment variables."""
    self._load_from_env()