track(level: str = 'debug')¶
Decorator to track a callable.
You can track classes, methods, functions and properties using this decorator.
- Arjuna tracks the following and logs it as per log_* function chosen as per provided level. Default is debug.
Begin of call and arguments passed to the call.
End of the call with return value
Exception raised if any
- Keywrod Arguments:
callable: Callable that is decorated. level: (Optional) A string representing a Logging Level (trace/debug/info/warning/error/fatal). Default is debug.
When you decorate a class with @track, it automatically tracks its construction, all its methods including classmethods and staticmethods.
Properties are not auto-tracked for a class.
You can add @track decorator to a property. If you have a property setter, adding @track to it automatically also tracks the getter.
You can selectively add decorators to methods in the class as well.
@track also works for functions.