Skip to content

Conversation

@raggi
Copy link
Member

@raggi raggi commented 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

@raggi raggi requested review from bradfitz and codekitchen October 27, 2025 22:27
@raggi raggi force-pushed the raggi/sqlite3_log branch 5 times, most recently from 22be4ee to 5475f39 Compare October 27, 2025 22:41
Comment on lines 3 to 15
// #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);
// }
Copy link
Member

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?

Copy link
Member Author

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) {
Copy link
Member

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?

Copy link
Member

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

Copy link
Member Author

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
@raggi raggi force-pushed the raggi/sqlite3_log branch from 5475f39 to 0d2ce1f Compare October 27, 2025 23:54
@raggi raggi merged commit 15f073d into main Oct 27, 2025
2 checks passed
raggi added a commit that referenced this pull request Oct 28, 2025
Discussed briefly in #113, a cleanup to follow common style.

Updates #113
raggi added a commit that referenced this pull request Oct 28, 2025
Discussed briefly in #113, a cleanup to follow common style.

Updates #113
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants