Example

Walkthrough: nested tracing

Step through a sample checkout() → price() → format() call from the Python library.

Call Stack

Trace Output

Python code sample
from indentlogger import IndentLogger, LogStyle

logger = IndentLogger()
logger.configure(style=LogStyle.SIMPLE, level=10, auto_log_level=10)

@logger.log_entry_exit
def checkout(cart):
    total = price(cart)
    logger.info(f"Total: {total}")
    return total

@logger.log_entry_exit
def price(cart):
    raw = sum(cart)
    return format(raw)

@logger.log_entry_exit
def format(amount):
    logger.info(f"Formatting ${amount:.2f}")
    return f"${amount:.2f}"

checkout([9.99, 4.50])

Source: github.com/gaviral/indentlogger

Browser example of the Python library.