-
Couldn't load subscription status.
- Fork 7
.,cgosqlite: add log handler callback #113
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
Conversation
22be4ee to
5475f39
Compare
| // #include <sqlite3.h> | ||
| // | ||
| // void logCallbackGo(void* userData, int errCode, char* msgC); | ||
| // | ||
| // static void log_callback_into_go(void *userData, int errCode, const char *msg) { | ||
| // logCallbackGo(userData, errCode, (char*)msg); | ||
| // } | ||
| // | ||
| // static int ts_sqlite3_config_log(void) { | ||
| // return sqlite3_config(SQLITE_CONFIG_LOG, log_callback_into_go, 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.
isnt /* .... */ comment style more common for cgo C code so it doesn't look like commented out code?
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.
Perhaps, but this would be the first code in this package to follow that convention
| ) | ||
|
|
||
| //export logCallbackGo | ||
| func logCallbackGo(userData unsafe.Pointer, errCode C.int, msgC *C.char) { |
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.
you're not using the userData? This is global and not per-DB?
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.
I figured you'd do like 695e777 did for the WALHook
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 global yeah, it's a sqlite3_config option, thankfully one of the few that can be set after sqlite3_initialize.
SQLite logs can contain useful diagnostic information such as access misuse and other out of band failure modes. Updates tailscale/corp#33477 Updates tailscale/corp#33305 Updates tailscale/corp#33577
5475f39 to
0d2ce1f
Compare
SQLite logs can contain useful diagnostic information such as access misuse and other out of band failure modes.
Updates tailscale/corp#33477
Updates tailscale/corp#33305
Updates tailscale/corp#33577