diff --git a/crates/storage/Cargo.toml b/crates/storage/Cargo.toml index 12992e4..b0c0c4e 100644 --- a/crates/storage/Cargo.toml +++ b/crates/storage/Cargo.toml @@ -21,8 +21,14 @@ tokio = { version = "1", features = ["rt", "sync", "macros"] } # Serialisation (DailyCompletionCount exposed to frontend via Tauri commands) serde = { version = "1", features = ["derive"] } -# Logging -log = "0.4" +# Structured logging via `tracing` so storage events bridge into the +# subscriber installed by src-tauri/src/lib.rs::install_subscriber and +# land in both stderr and the rolling lumotia.log forensic stream. The +# storage crate was on the `log` crate up to Phase B.8; without a +# log→tracing bridge (e.g. tracing-log::LogTracer) those events +# vanished even though the EnvFilter directive `lumotia_storage=info` +# advertised them as visible. +tracing = "0.1" # Structured error derivation for lumotia_storage::Error. thiserror = "1" diff --git a/crates/storage/src/database.rs b/crates/storage/src/database.rs index 5ac0c4b..9fc417c 100644 --- a/crates/storage/src/database.rs +++ b/crates/storage/src/database.rs @@ -366,7 +366,7 @@ pub async fn delete_transcript(pool: &SqlitePool, id: &str) -> Result<()> { if let Some(path) = audio_path.as_deref() { if let Err(err) = tokio::fs::remove_file(path).await { if err.kind() != std::io::ErrorKind::NotFound { - log::warn!( + tracing::warn!( target: "lumotia_storage", "delete_transcript: failed to remove audio file at {path}: {err}" ); @@ -431,7 +431,7 @@ pub async fn purge_deleted_transcripts(pool: &SqlitePool, older_than_days: i64) for path in &audio_paths { if let Err(err) = tokio::fs::remove_file(path).await { if err.kind() != std::io::ErrorKind::NotFound { - log::warn!( + tracing::warn!( target: "lumotia_storage", "purge_deleted_transcripts: failed to remove audio file at {path}: {err}" ); diff --git a/crates/storage/src/migrations.rs b/crates/storage/src/migrations.rs index 34c9d68..c2fe9f5 100644 --- a/crates/storage/src/migrations.rs +++ b/crates/storage/src/migrations.rs @@ -600,7 +600,12 @@ async fn run_migrations_slice(pool: &SqlitePool, migrations: &[(i64, &str, &str) for (version, description, sql) in migrations { if *version > current { - log::info!("Running migration {}: {}", version, description); + tracing::info!( + target: "lumotia_storage", + version, + description, + "running migration", + ); let mut tx = pool.begin().await.map_err(|source| Error::Migration { version: Some(*version), @@ -636,7 +641,11 @@ async fn run_migrations_slice(pool: &SqlitePool, migrations: &[(i64, &str, &str) source, })?; - log::info!("Migration {} complete", version); + tracing::info!( + target: "lumotia_storage", + version, + "migration complete", + ); } }