loggers module

Provides logging functionality.

class loggers.LogManager(name, level, areas, filepath=None, log_format=None, date_format=None)[source]

Bases: loggers._LogInstance

Main log class used as a root to create children instances.

__init__(name, level, areas, filepath=None, log_format=None, date_format=None)[source]

Store the base values and creates the logger.

Parameters:
  • name (str) – Name of the base logger.
  • level (ConVar) – A console variable that defines required level to log a message.
  • areas (ConVar) – A console variable that defines the areas where messages are getting logged.
  • filepath (str) – A file where messages are getting logged.
  • log_format (str) – A custom log format that defines the appearance of the messages.
  • date_format (str) – A custom date format that defines how the date is printed.
areas

Return the areas to print messages to.

Return type:int
level

Return the needed level value.

Return type:int
class loggers._LogInstance(parent=None, name=None)[source]

Bases: dict

Base logging class used to create child logging instances.

__init__(parent=None, name=None)[source]

Store the parent and gets a child of the parent.

Parameters:
  • parent (_LogInstance) – A parent logger or None.
  • name (str) – A name for the logger or None.
static _get_level_value(level)[source]

Return a level value used by the logging package.

Return type:int
_log(level, msg, *args, **kwargs)[source]

Main logging method.

clear()[source]

Delete each item individually to close all loggers.

log(level, msg, *args, **kwargs)[source]

Use to call a message with the given logging level.

Parameters:
  • level (int) – Level of the message to log.
  • msg (str) – Message to log.
  • args – Additional arguments that are used for formatting purpose.
  • kwargs – Additional keywords that are used for formatting purpose.
log_critical(msg, *args, **kwargs)[source]

Use to call a critical message.

Parameters:
  • msg (str) – Message to log.
  • args – Additional arguments that are used for formatting purpose.
  • kwargs – Additional keywords that are used for formatting purpose.
log_debug(msg, *args, **kwargs)[source]

Use to call a debug message.

Parameters:
  • msg (str) – Message to log.
  • args – Additional arguments that are used for formatting purpose.
  • kwargs – Additional keywords that are used for formatting purpose.
log_exception(msg, *args, **kwargs)[source]

Use to call an exception message.

Parameters:
  • msg (str) – Message to log.
  • args – Additional arguments that are used for formatting purpose.
  • kwargs – Additional keywords that are used for formatting purpose.
log_info(msg, *args, **kwargs)[source]

Use to call a basic info message.

Parameters:
  • msg (str) – Message to log.
  • args – Additional arguments that are used for formatting purpose.
  • kwargs – Additional keywords that are used for formatting purpose.
log_message(msg, *args, **kwargs)[source]

Use to call a message that should always print.

Parameters:
  • msg (str) – Message to log.
  • args – Additional arguments that are used for formatting purpose.
  • kwargs – Additional keywords that are used for formatting purpose.
log_warning(msg, *args, **kwargs)[source]

Use to call a warning message.

Parameters:
  • msg (str) – Message to log.
  • args – Additional arguments that are used for formatting purpose.
  • kwargs – Additional keywords that are used for formatting purpose.
areas

Return the root’s areas value.

Return type:int
formatter

Return the root’s formatter.

Return type:Formatter
level

Return the root’s level value.

Return type:int
logger

Return the instance’s logger.

Return type:logging.Logger
root

Return the root logger.

Return type:_LogInstance