sailorproject / sailor

A Lua MVC Web Framework.
MIT License
921 stars 125 forks source link

Database query logger proposal #147

Open soapdog opened 7 years ago

soapdog commented 7 years ago

Hey Friends,

I was facing a silly SQL syntax error in my project and due to the fact that MySQL error message do not contains the full query used, I ended up coding my own little query logger.

Basically, if the database configuration contains log_database_queries = true, then a file runtime/logs/query.log is populated. So you can have your production code and development code with different logging settings.

This required changing some files at the db folder, and the blank app. Don`t know if this is useful to others so I decided to post here before sending a PR.

https://github.com/soapdog/sailor/tree/b-enhancement-database-query-log

PS: And yes, I was tired and wrote JS inside a Lua file and it took me two commits before I realized that.

Etiene commented 7 years ago

I think this would be very useful, if no one is adverse, I would merge it :) Go ahead and make the PR! :D