Library¶
Important
Imports pyrolog.group, pyrolog.logger, pyrolg.logging_context,
pyrolog.handlers, pyrolog.formatters, pyrolog.version, pyrolog.colors
must be used without the .group, .logger, .logging_context, etc. prefixes
if you use import pyrolog. These modules imports as from .MOD import *.
Other modules: pyrolog.defaults, pyrolog.types, pyrolog.utils, pyrolog.
empty_colors must be imported as is.
pyrolog¶
Pyrolog. Pretty logging library. Copyright (C) 2023 ftdot (https://github.com/ftdot)
- pyrolog.get_plain_logger(log_level: str | int | LogOnlyLevels = 'info')¶
Gets logger (unnamed) with StdoutHandler and plain formatter. Also, uses given log level.
- Parameters:
log_level (types.LogLevel) – Log level
- pyrolog.get_colored_logger(log_level: str | int | LogOnlyLevels = 'info')¶
Gets logger (unnamed) with StdoutHandler and colored formatter. Also, uses given log level.
- Parameters:
log_level (types.LogLevel) – Log level
pyrolog.version¶
This module contains version information of the library.
Important
Due to the library’s import system, if you import pyrolog by this code:
import pyrolog
You must use this as:
pyrolog.__version__
As example.
Also, VersionInfo isn’t imports by default. You can’t use it with code like this:
pyrolog.VersionInfo
See below for details how to use it, if you really want this.
- pyrolog.version.VersionInfo = <class 'pyrolog.version.VersionInfo'>¶
Named tuple type.
Warning
This isn’t imports by default! You can import this by using this code:
from pyrolog.version import VersionInfo
- pyrolog.version.__version__ = '2.3.0'¶
String with the current version of the library
- pyrolog.version.__version_tuple__ = (2, 3, 0)¶
Tuple with the current version of the library
- pyrolog.version.__version_info__ = (2, 3, 0, 'release', 'a6c699f')¶
Named tuple with the current version + technical details of the library release
pyrolog.logging_context¶
Dedicated module for the LoggingContext class.
Important
Due to the library’s import system, if you import pyrolog by this code:
import pyrolog
You must use this as:
pyrolog.LoggingContext
As example.
- class pyrolog.logging_context.LoggingContext(log_levels: dict[str, int])¶
Bases:
objectDefines some variables that is “unique” for every logging context.
- Variables:
log_levels – Dict with the registered log levels.
loggers – List with the loggers pinned to logging context instance.
groups – List with the groups pinned to logging context instance.
groups_by_name – Dictionary with groups with names as keys.
- __init__(log_levels: dict[str, int])¶
- Parameters:
log_levels (LogLevelDict) – Dict with the registered log levels.
- enable_all_loggers()¶
Enables all loggers pinned to the logging context.
- disable_all_loggers()¶
Disables all loggers pinned to the logging context.
- enable_all_groups()¶
Enables all groups pinned to the logging context.
- disable_all_groups()¶
Disables all groups pinned to the logging context.
- get_level_offset()¶
- get_logger_name_offset()¶
- get_group_name_offset()¶
pyrolog.group¶
Dedicated module for Group class.
Important
Due to the library’s import system, if you import pyrolog by this code:
import pyrolog
You must use this as:
pyrolog.Group
As example.
- class pyrolog.group.Group(name: str = '', handlers: ~pyrolog.handlers.Handler | list[~pyrolog.handlers.Handler] | None = None, logging_context: ~pyrolog.logging_context.LoggingContext = <pyrolog.logging_context.LoggingContext object>, group_color: str = '', enabled: bool = True, parent_group: ~pyrolog.group.Group | str | None = None)¶
Bases:
objectA group class, that very helpful if you use many loggers in your project.
- Variables:
name – Name of the group.
handlers – Handlers to be used by loggers.
logging_context – The current logging context. (by default is defaults.DEFAULT_LOGGING_CONTEXT of
pyrolog.defaultsmodule)group_color – Color of the group. (visible only by using ColoredFormatter)
enabled – If it is set to False, all pinned loggers will not log any messages and all subgroups pinned to will be disabled. Do not change it manually, use
Group.disable()andGroup.enable().parent_group – Parent group of this group.
subgroups – Subgroups of this group.
loggers – Loggers pinned to this group.
- __init__(name: str = '', handlers: ~pyrolog.handlers.Handler | list[~pyrolog.handlers.Handler] | None = None, logging_context: ~pyrolog.logging_context.LoggingContext = <pyrolog.logging_context.LoggingContext object>, group_color: str = '', enabled: bool = True, parent_group: ~pyrolog.group.Group | str | None = None)¶
- Parameters:
name (str) – Name of the group.
handlers (Handler | list[Handler] | None) – Handlers to be used by loggers.
logging_context (LoggingContext) – The current logging context. (by default is defaults.DEFAULT_LOGGING_CONTEXT)
group_color (str) – Color of the group. (visible only by using ColoredFormatter)
enabled (bool) – If it is set to False, all pinned loggers will not log any messages and all subgroups pinned to will be disabled.
parent_group (Group | str | None) – Parent of this group. If it is not None, then copies all parameters from that group.
- enable()¶
Enables this group and all pinned loggers and subgroups.
- disable()¶
Enables this group and all pinned loggers and subgroups.
- subgroup(*args, **kwargs)¶
Alternative constructor of the
Group. But with “parent_group” set to exist instance. This method is shorthand for Group(…, parent_group=self). All arguments passed to this function is passed to the constructor of the group.Example:
example_group = pyrolog.Group('ExampleGroup', handlers=[..., ]) example_sub_group = example_group.subgroup() example_logger = example_group.group(name='ExampleLogger', group_color=pyrolog.TextColor.red)
- logger(*args, **kwargs)¶
Alternative constructor of the
Logger. But with “group” set to exist instance. This method is shorthand for Logger(…, group=self). All arguments passed to this function is passed to the constructor of the logger.Example:
example_group = pyrolog.Group('ExampleGroup', handlers=[..., ]) example_logger = example_group.logger(name='ExampleLogger', logger_color=pyrolog.TextColor.cyan)
pyrolog.logger¶
Dedicated module for the Logger class.
Important
Due to the library’s import system, if you import pyrolog by this code:
import pyrolog
You must use this as:
pyrolog.Logger
As example.
- class pyrolog.logger.Logger(name: str = '', handlers: ~pyrolog.handlers.Handler | list[~pyrolog.handlers.Handler] | None = None, logging_context: ~pyrolog.logging_context.LoggingContext = <pyrolog.logging_context.LoggingContext object>, logger_color: str = '', group: Group | str | None = None, enabled: bool = True)¶
Bases:
objectA logger object.
- Variables:
name – Name of the logger.
handlers – Handlers to be used by logger.
logging_context – The current logging context. (by default is defaults.DEFAULT_LOGGING_CONTEXT)
- __init__(name: str = '', handlers: ~pyrolog.handlers.Handler | list[~pyrolog.handlers.Handler] | None = None, logging_context: ~pyrolog.logging_context.LoggingContext = <pyrolog.logging_context.LoggingContext object>, logger_color: str = '', group: Group | str | None = None, enabled: bool = True)¶
Creates a new Logger object.
- Parameters:
name (str | None) – Name of the logger. (by default it is empty)
handlers (Handler | list[Handler] | None) – Handlers to be used by logger.
logging_context (LoggingContext) – The current logging context. (by default is defaults.DEFAULT_LOGGING_CONTEXT)
logger_color (str) – Color of the logger. (visible only by using ColoredFormatter)
group (Group | str | None) – Group of the logger. If it is not None, then copies all parameters from that group.
enabled (bool) – If it is set to False, logger will not log any messages.
- set_level(level: str | int | LogOnlyLevels)¶
Sets given log level to all handlers.
- Parameters:
level (LogLevel) – Log level.
- add_handler(handler: Handler)¶
Adds a new handler to the logger.
- Parameters:
handler (Handler) – New handler to be added.
- remove_handler(handler: Handler)¶
Removes handler from the logger. Ignores if handler isn’t used in logger.
- Parameters:
handler (Handler) – Handler to be removed.
- enable()¶
Enables a logger.
- disable()¶
Disables a logger.
- record(message: str, level: str | int, *args: Any, exc: Exception | None = None, **kwargs: dict[str, Any])¶
Records a message at the specified logging level.
- static bind_log_methods()¶
Binds all log methods for the Logger object instance.
pyrolog.handlers¶
Module that defines a base of the handlers and all the library handlers.
Important
Due to the library’s import system, if you import pyrolog by this code:
import pyrolog
You must use this as:
pyrolog.StdoutHandler
As example.
- class pyrolog.handlers.Handler(log_level: str | int | ~pyrolog._types.LogOnlyLevels = 'info', formatter: ~pyrolog.formatters.Formatter = <pyrolog.formatters.PlainFormatter object>, logging_context: ~pyrolog.logging_context.LoggingContext = <pyrolog.logging_context.LoggingContext object>, log_exceptions: bool = True, enabled: bool = True)¶
Bases:
objectA base of all the handlers.
- Variables:
log_level – Log level.
formatter – Formatter that will use this handler.
logging_context – Logging context.
log_exceptions – Determines whether log exceptions or not.
enabled – Determines whether log any message or not. Isn’t recommended to change it manually, but you may. Is recommended to use
enable()anddisable()methods.
- __init__(log_level: str | int | ~pyrolog._types.LogOnlyLevels = 'info', formatter: ~pyrolog.formatters.Formatter = <pyrolog.formatters.PlainFormatter object>, logging_context: ~pyrolog.logging_context.LoggingContext = <pyrolog.logging_context.LoggingContext object>, log_exceptions: bool = True, enabled: bool = True)¶
- Parameters:
log_level (LogLevel) – Log level.
formatter (Formatter) – Formatter that will use this handler.
logging_context (LoggingContext) – Logging context.
log_exceptions (bool) – Determines whether log exceptions or not.
enabled (bool) – Determines whether log any message or not.
- enable()¶
Enables handler.
- disable()¶
Disables handler.
- class pyrolog.handlers.IOHandler(io: TextIO, *args: Any, **kwargs: dict[str, Any])¶
Bases:
HandlerA base of IO handlers.
- Variables:
io – IO to be used to write messages.
- __init__(io: TextIO, *args: Any, **kwargs: dict[str, Any])¶
- Parameters:
io (TextIO) – IO to be used to write messages.
- write(message: str, level: str | int, logger_color: str, logger_name: str, group_name: str, group_color: str, exc: Exception | None = None, time: datetime | None = None, fmt_args: list[Any] | None = None, fmt_kwargs: dict[str, Any] | None = None)¶
- set_level(level: str | int | LogOnlyLevels)¶
Sets log level of handler to given.
- Parameters:
level (LogLevel) – Log level.
- class pyrolog.handlers.StdoutHandler(*args: Any, **kwargs: dict[str, Any])¶
Bases:
IOHandlerHandles stdout output (console). This class is shorthand for IOHandler(sys.stdout, …).
- class pyrolog.handlers.StderrHandler(*args: Any, **kwargs: dict[str, Any])¶
Bases:
IOHandlerHandles stderr output (console). This class is shorthand for IOHandler(sys.stdout, …).
- class pyrolog.handlers.FileHandler(path: str | bytes | PathLike[str] | PathLike[bytes] | int, encoding: str = 'utf8', *args: Any, **kwargs: dict[str, Any])¶
Bases:
IOHandlerHandles file output.
- Variables:
file_io – Opened file object.
path – Path to the file.
encoding – Encoding, by default is the UTF-8.
pyrolog.formatters¶
Contains base of formatters and all defined in the library formatters.
Important
Due to the library’s import system, if you import pyrolog by this code:
import pyrolog
You must use this as:
pyrolog.PlainFormatter
As example.
- pyrolog.formatters.fmt¶
Special type to specify formatting in
ColoredFormatteruse case.
- class pyrolog.formatters.Uncolored(value: Any)¶
Bases:
objectUsed in context where required to log an object to the
ColoredFormatterwithout colors.- Variables:
value – Original value.
- __init__(value: Any)¶
- Parameters:
value – Any value you want to pass to the
ColoredFormatterwithout colors.
- class pyrolog.formatters.Formatter(format_string: str = '{level:<{level_offset}} {message}', time_format_string: str = '{hour:02d}:{minute:02d}:{second:02d}.{microsecond}', static_variables: dict[str, ~typing.Any] | None = None, logging_context: ~pyrolog.logging_context.LoggingContext = <pyrolog.logging_context.LoggingContext object>)¶
Bases:
objectA base of all the formatters.
- Variables:
format_string – Format string.
time_format_string – Format string of the time.
static_variables – Static variables. (can be used in messages)
logging_context – Logging context.
time_formatting – (System variable. Do not change it manually) Determines whether to spend time formatting time.
- __init__(format_string: str = '{level:<{level_offset}} {message}', time_format_string: str = '{hour:02d}:{minute:02d}:{second:02d}.{microsecond}', static_variables: dict[str, ~typing.Any] | None = None, logging_context: ~pyrolog.logging_context.LoggingContext = <pyrolog.logging_context.LoggingContext object>)¶
- Parameters:
format_string (str) – Format string.
time_format_string (str) – Format string of the time.
static_variables (VarDict | None) – Static variables. (can be used in messages)
logging_context (LoggingContext) – Logging context.
- property format_string¶
- add_static_variable(name: str, value: Any)¶
Adds static variable.
- Parameters:
name (str) – Name of the static variable.
value (Any) – Value of the static variable.
- del_static_variable(name: str) bool¶
Deletes static variable.
- Parameters:
name (str) – Name of the static variable to be deleted.
- class pyrolog.formatters.PlainFormatter(*args: Any, offsets: bool = True, **kwargs: dict[str, Any])¶
Bases:
FormatterPlain formatter with offsets support.
- Variables:
offsets – Determines whether to use offsets or not.
- __init__(*args: Any, offsets: bool = True, **kwargs: dict[str, Any])¶
- Parameters:
offsets (bool) – If True, format string can use offsets to prettify output.
- format_message(message: str, level: str, logger_color: str, logger_name: str, group_name: str, group_color: str, fmt_args: list[Any], fmt_kwargs: dict[str, Any])¶
- class pyrolog.formatters.ColoredFormatter(format_string: str = '{level_color}{level:<{level_offset}}{reset} {message}', time_format_string: str = '{fore.cyan}{hour:02d}{fore.reset}:{fore.cyan}{minute:02d}{fore.reset}:{fore.cyan}{second:02d}{fore.reset}.{fore.lightmagenta}{microsecond}{fore.reset}', *args: ~typing.Any, color_dict: dict[~typing.Literal['types', 'levels'], dict[str | type, ~typing.Any]] = {'levels': {'critical': '\x1b[31m\x1b[1m', 'debug': '\x1b[97m', 'error': '\x1b[91m', 'exception': '\x1b[93m', 'info': '\x1b[96m', 'warn': '\x1b[33m'}, 'types': {'all': '\x1b[96m\x1b[1m', 'exception': '\x1b[91m', <class 'bool'>: '\x1b[33m', <class 'bytes'>: '\x1b[91m\x1b[1m', <class 'dict'>: '\x1b[36m', <class 'float'>: '\x1b[95m\x1b[1m', <class 'int'>: '\x1b[95m', <class 'list'>: '\x1b[93m', <class 'str'>: '\x1b[92m', <class 'tuple'>: '\x1b[93m\x1b[1m'}}, use_repr: bool = False, unpack_lists: bool = False, unpack_dicts: bool = False, **kwargs: dict[str, ~typing.Any])¶
Bases:
PlainFormatterColored formatter.
- Variables:
color_dict – Dict with the colors used to color formatting arguments by its type.
use_repr – If it set to True, repr() will be used instead of str() while format arguments.
- __init__(format_string: str = '{level_color}{level:<{level_offset}}{reset} {message}', time_format_string: str = '{fore.cyan}{hour:02d}{fore.reset}:{fore.cyan}{minute:02d}{fore.reset}:{fore.cyan}{second:02d}{fore.reset}.{fore.lightmagenta}{microsecond}{fore.reset}', *args: ~typing.Any, color_dict: dict[~typing.Literal['types', 'levels'], dict[str | type, ~typing.Any]] = {'levels': {'critical': '\x1b[31m\x1b[1m', 'debug': '\x1b[97m', 'error': '\x1b[91m', 'exception': '\x1b[93m', 'info': '\x1b[96m', 'warn': '\x1b[33m'}, 'types': {'all': '\x1b[96m\x1b[1m', 'exception': '\x1b[91m', <class 'bool'>: '\x1b[33m', <class 'bytes'>: '\x1b[91m\x1b[1m', <class 'dict'>: '\x1b[36m', <class 'float'>: '\x1b[95m\x1b[1m', <class 'int'>: '\x1b[95m', <class 'list'>: '\x1b[93m', <class 'str'>: '\x1b[92m', <class 'tuple'>: '\x1b[93m\x1b[1m'}}, use_repr: bool = False, unpack_lists: bool = False, unpack_dicts: bool = False, **kwargs: dict[str, ~typing.Any])¶
- Parameters:
format_string (str) – Format string.
time_format_string (str) – Format string of the time.
color_dict (ColorDict) – Dict with the colors used to color formatting arguments by its type.
use_repr (bool) – If it set to True, repr() will be used instead of str() while format arguments.
unpack_lists (bool) – Splits the elements by commas.
unpack_dicts (bool) – Splits the elements by commas and arrows (=>).
- format_message(message: str, level: str, level_color: str, logger_color: str, logger_name: str, group_name: str, group_color: str, fmt_args: list[Any], fmt_kwargs: dict[str, Any]) str¶
pyrolog.utils¶
This module contains utilities of the library.
Important
Due to the library’s import system, if you import pyrolog by this code:
import pyrolog
You must use this as:
pyrolog.utils.make_new_log_level(...)
As example.
- pyrolog.utils.make_logger_binding(level: str) Callable¶
Makes function-bind for given level.
- Parameters:
level (str) – Level.
- Returns:
Function-bind for given level.
- Return type:
Callable
- pyrolog.utils.make_new_log_level(logger_class: Logger, name: str, level: int, logging_context: ~pyrolog.logging_context.LoggingContext = <pyrolog.logging_context.LoggingContext object>)¶
Makes new log level and function-bind for it. Also adds function-bind to
Loggerclass. Note that name will be converted to lower case!- Parameters:
logger_class (Logger) – Class of the logger.
name (str) – Name of the new log level.
level (int) – Int level of the new log level.
logging_context (LoggingContext) – Logging context where it will be registered.
- pyrolog.utils.update_logger_name_offset(logging_context: ~pyrolog.logging_context.LoggingContext = <pyrolog.logging_context.LoggingContext object>)¶
Updates logger name offset.
- Parameters:
logging_context (LoggingContext) – Current logging context.
- pyrolog.utils.update_group_name_offset(logging_context: ~pyrolog.logging_context.LoggingContext = <pyrolog.logging_context.LoggingContext object>)¶
Updates group name offset.
- Parameters:
logging_context (LoggingContext) – Current logging context.
pyrolog._types¶
This module defines types of the library.
Important
Due to the library’s import system, if you import pyrolog by this code:
import pyrolog
You must use this as:
pyrolog.types.ColorDict
As example.
But, you can use LogOnlyLevels as following code:
pyrolog.LogOnlyLevels
- class pyrolog._types.LogOnlyLevels(levels: str | list[str])¶
Bases:
objectA class that allows you to fine-tune the desired logging levels.
- Variables:
levels – Levels to be logged.
- __init__(levels: str | list[str])¶
Determines which level(s) will be logged and which not.
Example usage:
import pyrolog stdout_handler = pyrolog.StdoutHandler( log_level=pyrolog.LogOnlyLevels( ['debug', 'info', 'warn'] ), formatter=pyrolog.PlainFormatter() ) stderr_handler = pyrolog.StderrHandler( log_level=pyrolog.LogOnlyLevels( ['exception', 'error', 'critical'] ), formatter=pyrolog.PlainFormatter() )
When using this handler, only the specified levels will be logged.
pyrolog.colors¶
Contains the color bindings to the colorama library.
Important
Due to the library’s import system, if you import pyrolog by this code:
import pyrolog
You must use this as:
pyrolog.TextColor
As example.
- class pyrolog.colors.TextColor¶
Bases:
objectBindings to colorama Fore colors.
- reset = '\x1b[39m'¶
- black = '\x1b[30m'¶
- red = '\x1b[31m'¶
- green = '\x1b[32m'¶
- blue = '\x1b[34m'¶
- cyan = '\x1b[36m'¶
- yellow = '\x1b[33m'¶
- magenta = '\x1b[35m'¶
- white = '\x1b[37m'¶
- lightblack = '\x1b[90m'¶
- lightred = '\x1b[91m'¶
- lightgreen = '\x1b[92m'¶
- lightblue = '\x1b[94m'¶
- lightcyan = '\x1b[96m'¶
- lightyellow = '\x1b[93m'¶
- lightmagenta = '\x1b[95m'¶
- lightwhite = '\x1b[97m'¶
- class pyrolog.colors.BGColor¶
Bases:
objectBindings to colorama Back colors.
- reset = '\x1b[49m'¶
- black = '\x1b[40m'¶
- red = '\x1b[41m'¶
- green = '\x1b[42m'¶
- blue = '\x1b[44m'¶
- cyan = '\x1b[46m'¶
- yellow = '\x1b[43m'¶
- magenta = '\x1b[45m'¶
- white = '\x1b[47m'¶
- lightblack = '\x1b[100m'¶
- lightred = '\x1b[101m'¶
- lightgreen = '\x1b[102m'¶
- lightblue = '\x1b[104m'¶
- lightcyan = '\x1b[106m'¶
- lightyellow = '\x1b[103m'¶
- lightmagenta = '\x1b[105m'¶
- lightwhite = '\x1b[107m'¶
pyrolog.empty_colors¶
Contains empty version of the color bindings of the colorama library. See pyrolog.colors.
Important
Due to the library’s import system, if you import pyrolog by this code:
import pyrolog
You must use this as:
pyrolog.empty_colors.EmptyTextColor
As example.
- class pyrolog.empty_colors.EmptyTextColor¶
Bases:
objectEmpty variant of
pyrolog.TextColor.- reset = ''¶
- black = ''¶
- red = ''¶
- green = ''¶
- blue = ''¶
- cyan = ''¶
- yellow = ''¶
- magenta = ''¶
- white = ''¶
- lightblack = ''¶
- lightred = ''¶
- lightgreen = ''¶
- lightblue = ''¶
- lightcyan = ''¶
- lightyellow = ''¶
- lightmagenta = ''¶
- lightwhite = ''¶
- class pyrolog.empty_colors.EmptyBGColor¶
Bases:
objectEmpty variant of
pyrolog.BGColor.- reset = ''¶
- black = ''¶
- red = ''¶
- green = ''¶
- blue = ''¶
- cyan = ''¶
- yellow = ''¶
- magenta = ''¶
- white = ''¶
- lightblack = ''¶
- lightred = ''¶
- lightgreen = ''¶
- lightblue = ''¶
- lightcyan = ''¶
- lightyellow = ''¶
- lightmagenta = ''¶
- lightwhite = ''¶
pyrolog.defaults¶
Module with the default definitions of library.
Important
Due to the library’s import system, if you import pyrolog by this code:
import pyrolog
You must use this as:
pyrolog.defaults.DEFAULT_LOG_LEVELS
As example.
- pyrolog.defaults.DEFAULT_LOG_LEVELS = {'critical': 30, 'debug': 5, 'error': 25, 'exception': 10, 'info': 15, 'notset': 9999, 'warn': 20}¶
The default log levels dictionary.
- pyrolog.defaults.MINIMAL_FORMAT_STRING = '{level:<{level_offset}} {message}'¶
The minimal formatter specification, which is the default and recommended for small projects.
- pyrolog.defaults.TIMED_MINIMAL_FORMAT_STRING = '{time} {level:<{level_offset}} {message}'¶
The minimal formatter specification, but with specified time.
- pyrolog.defaults.MINIMAL_TIME_FORMAT_STRING = '{hour:02d}:{minute:02d}:{second:02d}.{microsecond}'¶
The default minimal time format specification.
- pyrolog.defaults.MAXIMUM_TIME_FORMAT_STRING = '{year:04d}.{month:02d}.{day:02d} {hour:02d}:{minute:02d}:{second:02d}.{microsecond}'¶
Time Format specification that is recommended for professional, large projects.
- pyrolog.defaults.MAXIMUM_TIME_FORMAT_STRING_FILENAME_SAFE = '{year:04d}_{month:02d}_{day:02d}-{hour:02d}_{minute:02d}_{second:02d}_{microsecond}'¶
Time Format specification that is recommended for filename of the log files.
- pyrolog.defaults.MAXIMUM_FORMAT_STRING = '{time} | {level:<{level_offset}} | {group_name:<{group_name_offset}} | {logger_name:<{logger_name_offset}} -> {message}'¶
Format specification that is recommended for professional, large projects.
- pyrolog.defaults.DEFAULT_LOGGING_CONTEXT = <pyrolog.logging_context.LoggingContext object>¶
The logging context that is used by all elements of the logging library by default.
- pyrolog.defaults.DEFAULT_COLOR_DICT = {'levels': {'critical': '\x1b[31m\x1b[1m', 'debug': '\x1b[97m', 'error': '\x1b[91m', 'exception': '\x1b[93m', 'info': '\x1b[96m', 'warn': '\x1b[33m'}, 'types': {'all': '\x1b[96m\x1b[1m', 'exception': '\x1b[91m', <class 'bool'>: '\x1b[33m', <class 'bytes'>: '\x1b[91m\x1b[1m', <class 'dict'>: '\x1b[36m', <class 'float'>: '\x1b[95m\x1b[1m', <class 'int'>: '\x1b[95m', <class 'list'>: '\x1b[93m', <class 'str'>: '\x1b[92m', <class 'tuple'>: '\x1b[93m\x1b[1m'}}¶
The default color dict that is used by ColoredFormatter
- pyrolog.defaults.COLORED_MINIMAL_FORMAT_STRING = '{level_color}{level:<{level_offset}}{reset} {message}'¶
The colored minimal formatter specification, which is the default for the colored formatter and recommended for small projects.
- pyrolog.defaults.COLORED_TIMED_MINIMAL_FORMAT_STRING = '{time} {level_color}{level:<{level_offset}}{reset} {message}'¶
The minimal colored formatter specification, but with specified time.
- pyrolog.defaults.COLORED_MINIMAL_TIME_FORMAT_STRING = '{fore.cyan}{hour:02d}{fore.reset}:{fore.cyan}{minute:02d}{fore.reset}:{fore.cyan}{second:02d}{fore.reset}.{fore.lightmagenta}{microsecond}{fore.reset}'¶
The default colored minimal time format specification.
- pyrolog.defaults.COLORED_MAXIMUM_TIME_FORMAT_STRING = '{fore.cyan}{year:04d}{fore.reset}.{fore.cyan}{month:02d}{fore.reset}.{fore.cyan}{day:02d}{fore.reset} {fore.cyan}{hour:02d}{fore.reset}:{fore.cyan}{minute:02d}{fore.reset}:{fore.cyan}{second:02d}{fore.reset}.{fore.lightmagenta}{microsecond}{fore.reset}'¶
Colored time format specification that is recommended for professional, large projects.
- pyrolog.defaults.COLORED_MAXIMUM_FORMAT_STRING = '{time} | {level_color}{level:<{level_offset}}{reset} | {group_color}{group_name:<{group_name_offset}}{reset} | {logger_color}{logger_name:<{logger_name_offset}}{reset} -> {message}'¶
Colored format specification that is recommended for professional, large projects.