bumpversion.indented_logger
A logger adapter that adds an indent to the beginning of each message.
CURRENT_INDENT
python
CURRENT_INDENT = ContextVar('current_indent', default=0)IndentedLoggerAdapter
python
class IndentedLoggerAdapter(logger: logging.Logger, extra: Optional[dict] = None, depth: int = 2, indent_char: str = ' ', reset: bool = False)Logger adapter that adds an indent to the beginning of each message.
Parameters
logger: The logger to adapt.extra: Extra values to add to the logging context.depth: The number ofindent_charto generate for each indent level.indent_char: The character or string to use for indenting.reset:Trueif the indent level should be reset to zero.
current_indent
python
current_indent: intThe current indent level.
indent
python
def indent(amount: int = 1) -> NoneIncrease the indent level by amount.
dedent
python
def dedent(amount: int = 1) -> NoneDecrease the indent level by amount.
reset
python
def reset() -> NoneReset the indent level to zero.
indent_str
python
indent_str: strThe indent string.
process
python
def 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.kwargs: Keyword arguments passed to the logger.
Returns
- A tuple containing the message and keyword arguments.