1
0
Fork 0
forked from alemi/upub

fix: cleaner way to stop showing sqlx logs

This commit is contained in:
əlemi 2024-03-22 17:54:49 +01:00
parent 69c06d4a9c
commit 812fe05b6b

View file

@ -61,12 +61,13 @@ async fn main() {
tracing_subscriber::fmt() tracing_subscriber::fmt()
.compact() .compact()
.with_max_level(if args.debug { tracing::Level::DEBUG } else { tracing::Level::INFO }) .with_max_level(if args.debug { tracing::Level::DEBUG } else { tracing::Level::INFO })
.with(tracing_subscriber::filter::filter_fn(|x| args.debug || x.target() != "sqlx::query"))
.init(); .init();
// TODO can i do connectoptions.into() or .connect() and skip these ugly bindings?
let mut opts = ConnectOptions::new(&args.database); let mut opts = ConnectOptions::new(&args.database);
opts opts
.max_connections(1); .sqlx_logging_level(tracing::log::LevelFilter::Debug);
let db = Database::connect(opts) let db = Database::connect(opts)
.await.expect("error connecting to db"); .await.expect("error connecting to db");