From d593185b81a1a5d77782e377028dfbc45d024e3b Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 29 Dec 2020 14:35:51 +0200 Subject: [PATCH 1/2] Add a way to disable query logging programmatically --- sqlx-core/src/connection.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sqlx-core/src/connection.rs b/sqlx-core/src/connection.rs index a7d1438dbb..c709dfecee 100644 --- a/sqlx-core/src/connection.rs +++ b/sqlx-core/src/connection.rs @@ -166,4 +166,10 @@ pub trait ConnectOptions: 'static + Send + Sync + FromStr + Debug { /// Log executed statements with a duration above the specified `duration` /// at the specified `level`. fn log_slow_statements(&mut self, level: LevelFilter, duration: Duration) -> &mut Self; + + /// Entirely disables statement logging (both slow and regular). + fn disable_statement_logging(&mut self) -> &mut Self { + self.log_statements(LevelFilter::Off) + .log_slow_statements(LevelFilter::Off, Duration::default()) + } } From 3a1aae0570836c2fd6fff64965a5f36e43d2ddd6 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 29 Dec 2020 14:49:24 +0200 Subject: [PATCH 2/2] Fix the formatting --- sqlx-macros/src/derives/attributes.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sqlx-macros/src/derives/attributes.rs b/sqlx-macros/src/derives/attributes.rs index 373feaae98..13bc624e46 100644 --- a/sqlx-macros/src/derives/attributes.rs +++ b/sqlx-macros/src/derives/attributes.rs @@ -55,7 +55,10 @@ pub fn parse_container_attributes(input: &[Attribute]) -> syn::Result