.,cgosqlite: add log handler callback#113
Merged
Merged
Conversation
22be4ee to
5475f39
Compare
bradfitz
reviewed
Oct 27, 2025
Comment on lines
+3
to
+13
| // #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); | ||
| // } |
Member
There was a problem hiding this comment.
isnt /* .... */ comment style more common for cgo C code so it doesn't look like commented out code?
Member
Author
There was a problem hiding this comment.
Perhaps, but this would be the first code in this package to follow that convention
bradfitz
reviewed
Oct 27, 2025
| ) | ||
|
|
||
| //export logCallbackGo | ||
| func logCallbackGo(userData unsafe.Pointer, errCode C.int, msgC *C.char) { |
Member
There was a problem hiding this comment.
you're not using the userData? This is global and not per-DB?
Member
Author
There was a problem hiding this comment.
It's global yeah, it's a sqlite3_config option, thankfully one of the few that can be set after sqlite3_initialize.
bradfitz
approved these changes
Oct 27, 2025
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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