Skip to main content

helpers.timer()

Create a decorator that reports elapsed time on successful calls.

Usage

Source

helpers.timer(
    enabled=True,
    logger=None,
)

Parameters

enabled: bool = True

Whether to measure and report elapsed time.

logger: Callable[[str], None] | None = None
Callable that receives the timing message. By default, print it to standard output.

Returns

callable
A decorator that preserves the wrapped function’s arguments and result.