Inquest is a logging tool for python programs. It let's you add logs to your running python programs without restarting the program, redeploying the program, or modifying the code in any way. 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.
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.
There are two ways to use Inquest:
Frequently Asked Questions
How does Inquest work?
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.
This has 4 benefits:
- your underlying code object is never modified
- reverting a log statement is always possible and will always result in code behavior identical to the original
- it generates extremely efficient python
- it has not overhead
Why can't I edit the code in the dashboard?
The dashboard right now cannot persist changes to the files. So modifications to the file on the dashboard wouldn't have been reflected on the underlying file. This opens up an avenue for gotchas where you unintetionally change the IDE but never see those changes in your VCS. In order to avoid that, we made things, simple. The code viewer is read-only.