-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add set_log_hook/1 #266
add set_log_hook/1 #266
Conversation
3742b8f
to
1df4a0d
Compare
1df4a0d
to
5ff3d53
Compare
5ff3d53
to
d645ab1
Compare
d645ab1
to
6f69372
Compare
6f69372
to
4dd538f
Compare
4dd538f
to
72bfdb1
Compare
} | ||
|
||
log_hook_pid = pid; | ||
sqlite3_config(SQLITE_CONFIG_LOG, log_callback, NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a shame this log hook is global like this. I wish it were on a per sqlite database basis, but alas it is not. But I supposed you would only utilize this in a dev or test environment to track down a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason it's not per database is -- I guess -- to also be able to cover errors coming from opening invalid databases and some other operations that happen prior to getting a reference to a database.
The docs actually suggest using it in production: https://www.sqlite.org/errlog.html
Developers are encouraged to implement an error logger callback early in the development cycle in order to spot unexpected behavior quickly, and to leave the error logger callback turned on through deployment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳
Continues from #235
Based on #260