stephenafamo/bob

Logging Queries

x80486 opened this issue · 3 comments

For quick debugging, it would be great if Bob could print executed queries.

This is usually configured using hooks, but I'm not entirely sure if Bob has that concept.

At the same time, providing a way to toggle this back and forth using an environment variable will make it more useful for production issues, etc.

Since the bob.Executor is an interface, it is possible to do this by creating a executor that wraps another executor to do this.

Bob has bob.Debug() to do this, but you can create your own implementation that can be controlled with an environment variable.

Since this is something that will be used almost all the time, wouldn't make sense to provide a default implementation?

The default implementation is bob.Debug, just doesn't include ENV controls.

While I see the utility of the env variables, there will of course be many requirements from many users and there is no way to properly satisfy everyone. It would be far easier to just write your own implementation.