parent_lookup.utils.logging

Functions to configure logging for the application.

Functions

configure_logging([log_level_console, ...])

Configure logging for the application, allowing for both console and file logging.

parent_lookup.utils.logging.configure_logging(log_level_console: str = 'WARNING', log_file: Path | None = None, log_level_file: str = 'WARNING') → None

Configure logging for the application, allowing for both console and file logging.

Sets the log levels and formats for the output, ensuring that logs are captured as specified.

Parameters:
  • log_level_console (str) – Log level for console output. Defaults to "WARNING".

  • log_file (Path | None) – File to write logs to. If None, file logging is disabled. Defaults to None.

  • log_level_file (str) – Log level for file output. Defaults to "WARNING".

Raises:

TypeError – If either log level is not a valid logging level.

Return type:

None

Examples

Configure console and file logging with different levels:

>>> configure_logging(
...     log_level_console="INFO",
...     log_file=Path("app.log"),
...     log_level_file="DEBUG",
... )