fix: cleaner way to stop showing sqlx logs
This commit is contained in:
parent
69c06d4a9c
commit
812fe05b6b
1 changed files with 3 additions and 2 deletions
|
@ -61,12 +61,13 @@ async fn main() {
|
|||
tracing_subscriber::fmt()
|
||||
.compact()
|
||||
.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();
|
||||
|
||||
// TODO can i do connectoptions.into() or .connect() and skip these ugly bindings?
|
||||
let mut opts = ConnectOptions::new(&args.database);
|
||||
|
||||
opts
|
||||
.max_connections(1);
|
||||
.sqlx_logging_level(tracing::log::LevelFilter::Debug);
|
||||
|
||||
let db = Database::connect(opts)
|
||||
.await.expect("error connecting to db");
|
||||
|
|
Loading…
Reference in a new issue