switch logging over to log & env_logger crate

This commit is contained in:
2026-03-02 15:52:18 +01:00
parent f6a9807794
commit da5300b713
10 changed files with 219 additions and 15 deletions

View File

@@ -27,7 +27,7 @@ CREATE TABLE IF NOT EXISTS migrations (
pub struct DatabaseError(#[from] rusqlite::Error);
impl IntoResponse for DatabaseError {
fn into_response(self) -> axum::response::Response {
println!("[DB ERROR] {}", self);
log::error!("[DB ERROR] {}", self);
(StatusCode::INTERNAL_SERVER_ERROR, "Internal server error.").into_response()
}
}
@@ -55,14 +55,14 @@ pub fn migrations() -> Result<(), Box<dyn Error>> {
continue;
}
changes = true;
println!("Applying migration {key}...");
log::info!("Applying migration {key}...");
conn.execute_batch(sql)?;
conn.execute("INSERT INTO migrations(id) VALUES (?1)", [key])?;
}
if changes {
println!("Migrations applied.")
log::info!("Migrations applied.")
}
Ok(())
}