qmi.core.logging_init.start_logging

qmi.core.logging_init.start_logging(loglevel: int | str = 20, console_loglevel: int | str = 30, logfile: str | None = None, loglevels: Mapping[str, int | str] | None = None, rate_limit: float | None = None, burst_limit: int = 1, max_bytes: int = 10737418240, backup_count: int = 5) None

Initialize the Python logging framework for use by QMI.

This function sets up logging to stderr and optional logging to a file. The maximum size of a logfile can be given, and the number of rotating logfile count as well. The maximum total logfile disk space usage will be max_bytes * backup_count. Logging of Python warnings is enabled. Unhandled exceptions are logged to file.

This function is normally called automatically by qmi.start().

Parameters:
  • loglevel – Default log level (level of the root logger). Only log messages with at least this priority will be processed.

  • console_loglevel – Log level for logging to console. Only log messages with at least this priority will be logged to screen.

  • logfile – Optional file name of the log file. When omitted, logging to file will be disabled.

  • loglevels – Optional initial log levels for specific loggers. When specified, this is a dictionary mapping logger names to their initial log levels.

  • rate_limit – Maximum number of log messages per second per logger.

  • burst_limit – Maximum number of messages that can be “saved up” for a short burst of messages.

  • max_bytes – Maximum size of a log file in bytes. Default is 10GB = 10 * 2**30.

  • backup_count – Number of backup files to be used. Default is 5.