aqt.log#

Attributes#

Classes#

AnkiLoggerManager

There is [under normal circumstances] just one Manager instance, which

Functions#

get_addon_logs_folder(→ pathlib.Path)

find_addon_logger(→ logging.Logger | None)

setup_logging(→ None)

Set up logging for the application.

Module Contents#

aqt.log.ADDON_LOGGER_PREFIX = 'addon.'#
aqt.log.FORMATTER#
class aqt.log.AnkiLoggerManager(logs_path: pathlib.Path | str, existing_loggers: dict[str, logging.Logger | logging.PlaceHolder], rootnode: logging.RootLogger)#

Bases: logging.Manager

There is [under normal circumstances] just one Manager instance, which holds the hierarchy of loggers.

loggerDict#
logs_path#
getLogger(name: str) logging.Logger#

Get a logger with the specified name (channel name), creating it if it doesn’t yet exist. This name is a dot-separated hierarchical name, such as “a”, “a.b”, “a.b.c” or similar.

If a PlaceHolder existed for the specified name [i.e. the logger didn’t exist but a child of it did], replace it with the created logger and fix up the parent/child references which pointed to the placeholder to now point to the logger.

aqt.log.get_addon_logs_folder(logs_path: pathlib.Path | str, module: str) pathlib.Path#
aqt.log.find_addon_logger(module: str) logging.Logger | None#
aqt.log.setup_logging(path: pathlib.Path | str, **kwargs) None#

Set up logging for the application.

Configures the root logger to output logs to stdout by default, with custom handling for add-on logs. The add-on logs are saved to a separate folder and file for each add-on, under the path provided.

Args:

path (Path): The path where the log files should be stored. **kwargs: Arbitrary keyword arguments for logging.basicConfig