From 39cb4c5973fc08eeb9c10c7ae43e55d43e3a65fc Mon Sep 17 00:00:00 2001 From: LukeMathWalker Date: Thu, 30 Sep 2021 21:13:14 +0100 Subject: [PATCH] Lower level of sqxl's logs. --- Cargo.lock | 1 + Cargo.toml | 1 + src/configuration.rs | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 22acd25..4c79f74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2630,6 +2630,7 @@ dependencies = [ "claim", "config", "fake", + "log", "once_cell", "quickcheck", "quickcheck_macros", diff --git a/Cargo.toml b/Cargo.toml index da90324..e431030 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ config = { version = "0.10.1", default-features = false, features = ["yaml"] } sqlx = { version = "0.5.5", default-features = false, features = [ "runtime-actix-rustls", "macros", "postgres", "uuid", "chrono", "migrate", "offline"] } uuid = { version = "0.8.1", features = ["v4"] } chrono = "0.4.15" +log = "0.4" tracing = "0.1.19" tracing-futures = "0.2.4" tracing-subscriber = { version = "0.2.12", features = ["registry", "env-filter"] } diff --git a/src/configuration.rs b/src/configuration.rs index 8281ca0..6eca71d 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -1,5 +1,6 @@ use serde_aux::field_attributes::deserialize_number_from_string; use sqlx::postgres::{PgConnectOptions, PgSslMode}; +use sqlx::ConnectOptions; use std::convert::{TryFrom, TryInto}; #[derive(serde::Deserialize)] @@ -42,7 +43,9 @@ impl DatabaseSettings { } pub fn with_db(&self) -> PgConnectOptions { - self.without_db().database(&self.database_name) + let mut options = self.without_db().database(&self.database_name); + options.log_statements(log::LevelFilter::Trace); + options } }