loggers
Describe loggers as a class, or get a fully initialized logger with LoggerFactory.
LoggerConfig
dataclass
Bases: BaseLoggingConfig
Define a logging Logger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
The name of the logger. |
required |
level |
str
|
The level of log messages this logger should show (NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL). |
required |
handlers |
list[str]
|
List of handler names this logger should use. These handlers must exist in the logging dictConfig. |
required |
propagate |
bool
|
If |
False
|
Source code in src/red_logging/config_classes/loggers/_loggers.py
get_configdict()
Return a dict representation of the logger described by this class.
Source code in src/red_logging/config_classes/loggers/_loggers.py
LoggerFactory
Generate loggers based on LoggerFactory's config.
Source code in src/red_logging/config_classes/loggers/_factory.py
get_logger(name, log_level, handlers, formatters, loggers)
staticmethod
Initialize a logger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
The name of the logger. |
required |
log_level |
str
|
The log levels to show (NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL). |
required |
handlers |
dict[str, dict[str, Any]]
|
A dict describing the handlers for this logger config. |
required |
formatters |
dict[str, dict[str, Any]]
|
A dict describing the formatters for this logger config. |
required |
loggers |
dict[str, dict[str, Any]]
|
A dict describing the loggers for this logger config. |
required |