interplot.debug: Debugging Tool¶
A small tool to eavesdrop on function calls and print or log them.
Examples¶
>>> @interplot.debug.wiretap
... def func(foo):
... return foo + foo
... interplot.debug.start_logging(save_to_log=True, verbose=True)
... func("bar")
Wiretap log: {
"time": "2025-11-18 09:13:17.387600",
"function": "<function func at 0x323088680>",
"args": [
"bar"
],
"kwargs": {},
"result": "barbar"
}
'barbar'
>>> interplot.debug.get_log(-1)["args"] # get the last log entry
('bar',)
interplot.debug.wiretap¶
- interplot.debug.wiretap(core)¶
Decorator to log input and output of the decorated function.
Examples
>>> @interplot.debug.wiretap ... def func(foo): ... return foo + foo
- interplot.debug.start_logging(save_to_log=None, verbose=None)¶
Start logging function calls.
- Parameters:
- save_to_log: bool, optional
Data will be accessible at interplot.debug.log.
If undefined, the last setting will be used.
By default, save_to_log is turned on once logging is activated.
- verbose: bool, optional
Print payload to output on every call.
By default, verbose is turned on once logging is activated.
- interplot.debug.stop_logging()¶
Stop logging function calls.
- interplot.debug.get_log(index=None)¶
Get the logged events.
- interplot.debug.clear_log()¶
Clear the log.