configure_logging()

Configure logging for the smartclass package.

Usage

Source

configure_logging(
    level=logging.INFO,
    format_string=DEFAULT_FORMAT,
    date_format=DEFAULT_DATE_FORMAT,
    log_file=None,
    force=False
)

This should be called once at application startup. Subsequent calls will be ignored unless force=True.

Parameters

level: int | str = logging.INFO

Logging level (e.g. logging.DEBUG, logging.INFO, “DEBUG”, “INFO”). Default is logging.INFO.

format_string: str = DEFAULT_FORMAT

Format string for log records. Default is DEFAULT_FORMAT.

date_format: str = DEFAULT_DATE_FORMAT

Date format for log records. Default is DEFAULT_DATE_FORMAT.

log_file: Path | str | None = None

Optional path to also write logs to a file. Default is None.

force: bool = False
Reconfigure even if logging was already configured. Default is False.