indented_logger
A logger adapter that adds an indent to the beginning of each message.
Classes¶
IndentedLoggerAdapter
¶
IndentedLoggerAdapter(
logger: logging.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.
Parameters:
logger
-
The logger to adapt.
TYPE:
Logger
extra
-
Extra values to add to the logging context.
DEFAULT:
None
depth
-
The number of
indent_char
to generate for each indent level.TYPE:
int
DEFAULT:
2
indent_char
-
The character or string to use for indenting.
TYPE:
str
DEFAULT:
' '
reset
-
True
if the indent level should be reset to zero.TYPE:
bool
DEFAULT:
False
Attributes¶
Functions¶
process
¶
process(
msg: str, kwargs: Optional[MutableMapping[str, Any]]
) -> Tuple[str, MutableMapping[str, Any]]
Process the message and add the indent.
Parameters:
msg
-
The logging message.
TYPE:
str
kwargs
-
Keyword arguments passed to the logger.
TYPE:
Optional[MutableMapping[str, Any]]
Returns:
-
Tuple[str, MutableMapping[str, Any]]
-
A tuple containing the message and keyword arguments.