Skip to content

logging_config

src.utils.logging_config

Centralized logging configuration for the ReproDB pipeline.

add_log_level_arg(parser: argparse.ArgumentParser) -> None

Add a --log-level argument to an argparse parser.

Source code in src/utils/logging_config.py
17
18
19
20
21
22
23
24
def add_log_level_arg(parser: argparse.ArgumentParser) -> None:
    """Add a ``--log-level`` argument to an argparse parser."""
    parser.add_argument(
        "--log-level",
        choices=LOG_LEVELS,
        default="info",
        help="Set logging verbosity (default: info)",
    )

setup_logging(level: int = logging.INFO) -> None

Configure root logger with a consistent format.

Call once from each script's if __name__ == "__main__" block. from src.utils.logging_config import setup_logging setup_logging()

Accepts either an int (e.g. logging.DEBUG) or a str name (e.g. "debug").

Source code in src/utils/logging_config.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def setup_logging(level: int = logging.INFO) -> None:
    """Configure root logger with a consistent format.

    Call once from each script's ``if __name__ == "__main__"`` block.
    from src.utils.logging_config import setup_logging
    setup_logging()

    Accepts either an ``int`` (e.g. ``logging.DEBUG``) or a ``str``
    name (e.g. ``"debug"``).
    """
    if isinstance(level, str):
        level = LOG_LEVELS.get(level.lower(), logging.INFO)
    logging.basicConfig(
        level=level,
        format="%(message)s",
        stream=sys.stdout,
    )