vibe.decorators

Decorator utilities for VIBE.

bind_args_to_logger

bind_args_to_logger(**bindings_map: str) -> Callable[[Callable[P, R]], Callable[P, R]]

Bind specified arguments of the decorated function to structlog's contextvars.

Parameters:
  • **bindings_map (str, default: {} ) –

    A mapping where keys are the desired context keys for logging, and values are the names of the function parameters to bind.

Example

@bind_args_to_logger(template="template_id", version="version_id", state="literal state") def my_function(template_id, version_id, other_arg): # Will have template bound to template_id and state bound to "literal state". log.info("Processing")