Skip to content

Commit

Permalink
chore: lower sqlx logging to "debug"
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Mar 8, 2024
1 parent 9036ae4 commit ec6e8b0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions backend/api/src/system/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use crate::db::{ConnectionOrTransaction, Transactional};
use migration::Migrator;
use sea_orm::{ConnectionTrait, Database, DatabaseConnection, DbErr, Statement, TransactionTrait};
use sea_orm::{
ConnectOptions, ConnectionTrait, Database, DatabaseConnection, DbErr, Statement,
TransactionTrait,
};
use sea_orm_migration::MigratorTrait;
use std::fmt::{Debug, Display, Formatter};
use std::future::Future;
Expand Down Expand Up @@ -78,8 +81,12 @@ impl InnerSystem {
) -> Result<Self, anyhow::Error> {
let port = port.into().unwrap_or(5432);
let url = format!("postgres://{username}:{password}@{host}:{port}/{db_name}");
println!("connect to {}", url);
let db = Database::connect(url).await?;
log::info!("connect to {}", url);

let mut opt = ConnectOptions::new(url);
opt.sqlx_logging_level(log::LevelFilter::Trace);

let db = Database::connect(opt).await?;

Migrator::refresh(&db).await?;

Expand Down

0 comments on commit ec6e8b0

Please sign in to comment.