indented_logger
A logger adapter that adds an indent to the beginning of each message.
Classes¶
IndentedLoggerAdapter
¶
IndentedLoggerAdapter(
logger: Logger,
extra: Optional[dict] = None,
depth: int = 2,
indent_char: str = " ",
reset: bool = False,
)
Bases: LoggerAdapter
Logger adapter that adds an indent to the beginning of each message.
| PARAMETER | DESCRIPTION |
|---|---|
logger
|
The logger to adapt.
TYPE:
|
extra
|
Extra values to add to the logging context.
TYPE:
|
depth
|
The number of
TYPE:
|
indent_char
|
The character or string to use for indenting.
TYPE:
|
reset
|
TYPE:
|
Attributes¶
Functions¶
process
¶
process(
msg: str, kwargs: Optional[MutableMapping[str, Any]]
) -> Tuple[str, MutableMapping[str, Any]]
Process the message and add the indent.
| PARAMETER | DESCRIPTION |
|---|---|
msg
|
The logging message.
TYPE:
|
kwargs
|
Keyword arguments passed to the logger.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tuple[str, MutableMapping[str, Any]]
|
A tuple containing the message and keyword arguments. |
Functions¶
get_indented_logger
¶
get_indented_logger(name: str) -> IndentedLoggerAdapter
Get a logger with indentation.