Merge 'sqlite3: Switch to tracing logger' from Pekka Enberg

...we now actually see logging from core too.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1554
This commit is contained in:
Pekka Enberg
2025-05-22 13:02:24 +03:00
3 changed files with 9 additions and 5 deletions

4
Cargo.lock generated
View File

@@ -1976,7 +1976,9 @@ dependencies = [
"env_logger 0.11.7",
"libc",
"limbo_core",
"log",
"tracing",
"tracing-appender",
"tracing-subscriber",
]
[[package]]

View File

@@ -25,7 +25,9 @@ crate-type = ["lib", "cdylib", "staticlib"]
env_logger = { version = "0.11.3", default-features = false }
libc = "0.2.169"
limbo_core = { path = "../core" }
log = "0.4.22"
tracing = "0.1.41"
tracing-appender = "0.2.3"
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
[package.metadata.capi.header]
name = "sqlite3.h"

View File

@@ -2,7 +2,7 @@
#![allow(non_camel_case_types)]
use limbo_core::Value;
use log::trace;
use tracing::trace;
use std::ffi::{self, CStr, CString};
use std::rc::Rc;
@@ -85,7 +85,7 @@ static INIT_DONE: std::sync::Once = std::sync::Once::new();
#[no_mangle]
pub unsafe extern "C" fn sqlite3_initialize() -> ffi::c_int {
INIT_DONE.call_once(|| {
env_logger::init();
tracing_subscriber::fmt::init();
});
SQLITE_OK
}
@@ -131,7 +131,7 @@ pub unsafe extern "C" fn sqlite3_open(
SQLITE_OK
}
Err(e) => {
log::trace!("error opening database {}: {:?}", filename, e);
trace!("error opening database {}: {:?}", filename, e);
SQLITE_CANTOPEN
}
}