Skip to content

aria2_server.logger

The logger module for aria2_server.

This module will never import any other modules in aria2_server,

So, any other modules can import this module to use the logger.

__all__ module-attribute

__all__ = (
    "LOGGER_NAME",
    "configure_default_logging",
    "critical",
    "debug",
    "error",
    "exception",
    "info",
    "logger",
    "use_colors",
    "warning",
)

LOGGER_NAME module-attribute

LOGGER_NAME = 'aria2_server'

logger module-attribute

use_colors module-attribute

use_colors: bool = True

The flag to control whether to use ANSI color codes in the log messages.

debug module-attribute

debug = _build_colorized_logger_func(debug)

info module-attribute

info = _build_colorized_logger_func(info)

warning module-attribute

warning = _build_colorized_logger_func(warning)

error module-attribute

error = _build_colorized_logger_func(error)

exception module-attribute

exception = _build_colorized_logger_func(exception)

critical module-attribute

critical = _build_colorized_logger_func(critical)

configure_default_logging

configure_default_logging(level: int) -> None

Configure the default logging settings for aria2_server.

Usually, this function is used by cli.

Source code in src/aria2_server/logger.py
def configure_default_logging(level: int) -> None:
    """Configure the default logging settings for `aria2_server`.

    Usually, this function is used by cli.
    """
    logging.basicConfig(
        level=level,
        format="%(levelname)-5.5s [%(name)s] %(message)s",
        datefmt="%H:%M:%S",
    )