prefab
Pre-defined logging configs that can be imported and added to a assemble_dictconfig() call.
get_red_logging_console_handler(name='red_logging_console', level='DEBUG', formatter='red_logging', filters=None)
Return an initialized StreamHandlerConfig for the red_logging library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
The name of the handler, which you will reference in a logger config. |
'red_logging_console'
|
level |
str
|
The log level for the handler (NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL). |
'DEBUG'
|
formatter |
str
|
The name of the formatter to use. This formatter must exist in the logging dictConfig, and can be generated with a FormatterConfig. |
'red_logging'
|
filters |
list[str] | None
|
Optional list of filter function names to apply to the handler. |
None
|
Returns:
| Type | Description |
|---|---|
StreamHandlerConfig
|
An initialized StreamHandlerConfig class. |
Source code in src/red_logging/config_classes/prefab/third_party/prefab_red_logging/_configs.py
get_red_logging_formatter(name='red_logging', fmt=red_logging_FMT, datefmt=DATE_FMT_STANDARD)
Return a pre-configured FormatterConfig for the red_logging library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
The name of the formatter, which you will reference in a handler config. |
'red_logging'
|
fmt |
str
|
The log message format string. |
red_logging_FMT
|
datefmt |
str
|
The format for timestamps in log messages. |
DATE_FMT_STANDARD
|
Returns:
| Type | Description |
|---|---|
FormatterConfig
|
An initialized FormatterConfig class |
Source code in src/red_logging/config_classes/prefab/third_party/prefab_red_logging/_configs.py
get_red_logging_logger(name='red_logging', handlers=['red_logging_console'], level='WARNING', propagate=False)
Return an initialized LoggerConfig for the red_logging library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
str
|
The name of the logger, which you will reference in a logging config dict. |
'red_logging'
|
handlers |
list[str]
|
A list of handler names for the logger. These loggers must exist in the dictConfig. |
['red_logging_console']
|
level |
str
|
The log level for the handler (NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL). |
'WARNING'
|
propagate |
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
LoggerConfig
|
An initialized LoggerConfig class. |