logging¶
Logging factory and handlers
- mio.logging.init_logger(name: str, log_dir: Path | None | bool = None, level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'] | None = None, file_level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'] | None = None, log_file_n: int | None = None, log_file_size: int | None = None) Logger¶
Make a logger.
Log to a set of rotating files in the
log_diraccording toname, as well as using theRichHandlerfor pretty-formatted stdout logs.- Parameters:
name (str) – Name of this logger. Ideally names are hierarchical and indicate what they are logging for, eg.
mio.sdcardand don’t contain metadata like timestamps, etc. (which are in the logs)log_dir (
pathlib.Path) – Directory to store file-based logs in. IfNone, get fromConfig. IfFalse, disable file logging.level (
LOG_LEVELS) – Level to use for stdout logging. IfNone, get fromConfigfile_level (
LOG_LEVELS) – Level to use for file-based logging. IfNone, get fromConfiglog_file_n (int) – Number of rotating file logs to use. If
None, get fromConfiglog_file_size (int) – Maximum size of logfiles before rotation. If
None, get fromConfig
- Returns: