Skip to content

Commit 3779fbd

Browse files
committed
Set SQLx logging level to trace and display log target
1 parent 3c712ea commit 3779fbd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/bin/bors.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use bors::{
99
CommandParser, SeaORMClient, ServerState, WebhookSecret,
1010
};
1111
use clap::Parser;
12-
use sea_orm::Database;
12+
use sea_orm::{ConnectOptions, Database};
13+
use tracing::log::LevelFilter;
1314
use tracing_subscriber::EnvFilter;
1415

1516
use migration::{Migrator, MigratorTrait};
@@ -57,8 +58,12 @@ async fn webhook_server(state: ServerState) -> anyhow::Result<()> {
5758
}
5859

5960
async fn initialize_db(connection_string: &str) -> anyhow::Result<SeaORMClient> {
60-
let db = Database::connect(connection_string).await?;
61+
let mut opts = ConnectOptions::new(connection_string);
62+
opts.sqlx_logging_level(LevelFilter::Trace);
63+
64+
let db = Database::connect(opts).await?;
6165
Migrator::up(&db, None).await?;
66+
6267
Ok(SeaORMClient::new(db))
6368
}
6469

@@ -123,7 +128,6 @@ fn try_main(opts: Opts) -> anyhow::Result<()> {
123128

124129
fn main() {
125130
tracing_subscriber::fmt()
126-
.with_target(false)
127131
.with_env_filter(
128132
EnvFilter::builder()
129133
.with_default_directive(tracing::Level::INFO.into())

0 commit comments

Comments
 (0)