Inquest lets you add log statements to python without restarting your #python instance. It helps you quickly uncover what is going wrong.
Inquest takes extremely low overhead: the part that's a python library is completely idle unless there is something to log. Inquest is specifically designed to enable you to quickly introspect into Python even in production environments.
Inquest works by bytecode injection. The library sets up a connection with the backend. When you add a new log statment on the dashboard, the backend relays that change the connected python instance. Inside python, inquest finds the affected functions inside the VM.
Then it uses the python interpreter to recompile a newly generated piece of python bytecode with the new log statements inserted. Then inquest pointer-swaps the new bytecode with the old bytecode.
https://github.com/yiblet/inquest
Here's a gif of the magic. I'm running a single python instance in the background and I use Inquest to dynamically add log statements to the running code:
Post #613
2.7K