aqt.log
=======

.. py:module:: aqt.log


Attributes
----------

.. autoapisummary::

   aqt.log.ADDON_LOGGER_PREFIX
   aqt.log.FORMATTER


Classes
-------

.. autoapisummary::

   aqt.log.AnkiLoggerManager


Functions
---------

.. autoapisummary::

   aqt.log.get_addon_logs_folder
   aqt.log.find_addon_logger
   aqt.log.setup_logging


Module Contents
---------------

.. py:data:: ADDON_LOGGER_PREFIX
   :value: 'addon.'


.. py:data:: FORMATTER

.. py:class:: AnkiLoggerManager(logs_path: pathlib.Path | str, existing_loggers: dict[str, logging.Logger | logging.PlaceHolder], rootnode: logging.RootLogger)

   Bases: :py:obj:`logging.Manager`


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


   .. py:attribute:: loggerDict


   .. py:attribute:: logs_path


   .. py:method:: 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.



.. py:function:: get_addon_logs_folder(logs_path: pathlib.Path | str, module: str) -> pathlib.Path

.. py:function:: find_addon_logger(module: str) -> logging.Logger | None

.. py:function:: 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


