Skip to content

logging

logging

Logging utilities for VersatIL endpoints.

override_log_format

override_log_format()

Replace the log formatter on all root handlers.

Call after Hydra's @hydra.main has configured logging, so the format shows the source module instead of root.

Source code in src/versatil/common/logging.py
def override_log_format() -> None:
    """Replace the log formatter on all root handlers.

    Call after Hydra's ``@hydra.main`` has configured logging,
    so the format shows the source module instead of ``root``.
    """
    formatter = logging.Formatter(LOG_FORMAT)
    for handler in logging.root.handlers:
        handler.setFormatter(formatter)