@trail decorator to audit any function in your codebase — not just framework calls.
Setup
process_payment is called, ProvenLog automatically logs:
action_type— alwaysCUSTOMaction_name— thenameyou provide (defaults to the function name)action_input— the function argumentsaction_output— the return value (wrapped as{"return": ...})action_status—successorerror(based on whether the function raises)duration_ms— how long the function took
Parameters
Error handling
If the decorated function raises an exception, ProvenLog logs the event with:action_statusset to"error"error_messageset to the exception string
Async support
The decorator works with both sync and async functions:Prerequisites
The@trail decorator requires a ProvenLogClient to be active. When using auto-instrumentation (plog run or import provenlog.auto), a client is created automatically and registered as the default.
For explicit setup, create a client before calling any decorated functions: