Skip to content

log_guards

๐Ÿค– AI-Generated Content

This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.

flavor.utils.log_guards

Logging level guards for avoiding expensive f-string evaluation.

Functions

is_debug_enabled

is_debug_enabled() -> bool

Return True if the root logger has DEBUG or lower level active.

Source code in flavor/utils/log_guards.py
def is_debug_enabled() -> bool:
    """Return True if the root logger has DEBUG or lower level active."""
    return logging.root.level <= logging.DEBUG

is_trace_enabled

is_trace_enabled() -> bool

Return True if the root logger has TRACE (level 5) or lower level active.

Source code in flavor/utils/log_guards.py
def is_trace_enabled() -> bool:
    """Return True if the root logger has TRACE (level 5) or lower level active."""
    return logging.root.level <= _TRACE_LEVEL