global_logger package
Submodules
global_logger.global_logger module
Main Global Logger Module
- class global_logger.global_logger.Log(name, level=None, global_level=True, logs_dir=None, log_session_filename=None, max_log_files=None, file_message_format=None, screen_message_format=None, date_format_full=None, date_format=None, use_colors=True, direct=True)[source]
Bases:
object
- DEFAULT_LOGS_DIR = 'logs'
- GLOBAL_LOG_LEVEL = 20
- LOGGER_DATE_FORMAT = '%H:%M:%S'
- LOGGER_DATE_FORMAT_FULL = '%Y-%m-%d %H:%M:%S'
- LOGGER_FILE_MESSAGE_FORMAT = '%(asctime)s.%(msecs)03d %(lineno)3s:%(name)-22s %(levelname)-6s %(message)s'
- LOGGER_SCREEN_MESSAGE_FORMAT = '%(log_color)s%(message)s'
- class Levels(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntEnum
- CRITICAL = 50
- DEBUG = 10
- ERROR = 40
- FATAL = 50
- INFO = 20
- NOTSET = 0
- WARN = 30
- WARNING = 30
- MAX_LOG_FILES = 50
- auto_added_handlers: List[Handler] = []
- classmethod get_logger(name=None, level=None, global_level=True, logs_dir=None, log_session_filename=None, max_log_files=None, file_message_format=None, screen_message_format=None, date_format_full=None, date_format=None, use_colors=True)[source]
Main instantiating method for the class. Use it to instantiate global logger.
- Parameters:
name (str or unicode) – a unique logger name that is re-/used if already exists, defaults to the function path.
level (int) – Logging level for the current instance.
global_level (bool) – Treat this level as a global (True) or as an individual (False) Individual loggers do not gain global logging level changes.
logs_dir (Path or str or None) – Path where the .log files would be created, if provided.
log_session_filename (str or None) – Log output filename.
max_log_files (int) – Maximum .log files to store.
screen_message_format (str) – Screen Logging message format.
file_message_format (str) – File Logging message format.
date_format_full (str) – Logging full date format.
date_format (str) – Logging on-screen date format.
use_colors (bool) – Use colored Stdout and Stderr output
- Returns:
Log
instance to work with.- Return type:
- individual_loggers = {}
- property level
Returns current on-screen logging output level. File output is always DEBUG. :return: int or None
- log_session_filename = None
- loggers = {}
- logs_dir: Path = None
- printer(*message, **kwargs)[source]
- Parameters:
message (str or list of str or unicode) – a message to print: as a string or as a list of strings
end (str) – line ending symbol, defaults to
color (AnsiFore) – message color to use
clear (bool) – Whether to clear message string from ANSI symbols, defaults to True
- static set_global_log_level(level)[source]
Global Logging Level Setter Method. Sets Logging Level for all loggers of this type :type level: int :param level: Global Logging Level to set.
- property verbose
Module contents
Top-level package for Global Logger.