Add a trace layer

This commit is contained in:
Greg Burri 2024-11-03 12:11:33 +01:00
parent 980c5884a4
commit 1f03c01d1d
5 changed files with 26 additions and 21 deletions

View file

@ -13,6 +13,7 @@ use sqlx::{
Pool, Sqlite, Transaction,
};
use thiserror::Error;
use tracing::{event, Level};
use crate::{
consts,
@ -156,7 +157,7 @@ WHERE [type] = 'table' AND [name] = 'Version'
let next_version = current_version + 1;
if next_version <= CURRENT_DB_VERSION {
println!("Update to version {}...", next_version);
event!(Level::INFO, "Update to version {}...", next_version);
}
async fn update_version(to_version: u32, tx: &mut Transaction<'_, Sqlite>) -> Result<()> {
@ -171,7 +172,7 @@ WHERE [type] = 'table' AND [name] = 'Version'
fn ok(updated: bool) -> Result<bool> {
if updated {
println!("Version updated");
event!(Level::INFO, "Version updated");
}
Ok(updated)
}