Add a way to disable query logging programmatically

This commit is contained in:
Kirill Bulatov 2020-12-29 14:35:51 +02:00 committed by Austin Bonander
parent 63bbd3445b
commit 24c85d20d6

View File

@ -166,4 +166,10 @@ pub trait ConnectOptions: 'static + Send + Sync + FromStr<Err = Error> + 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())
}
}