Skip to content

Commit 51e45ce

Browse files
authored
Revert "feat: allow log level customization (#1371)" (#1465)
This reverts commit 719d800.
1 parent ba3e373 commit 51e45ce

File tree

4 files changed

+8
-59
lines changed

4 files changed

+8
-59
lines changed

sqlx-core/src/connection.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::database::{Database, HasStatementCache};
22
use crate::error::Error;
33
use crate::transaction::Transaction;
44
use futures_core::future::BoxFuture;
5-
pub use log::LevelFilter;
5+
use log::LevelFilter;
66
use std::fmt::Debug;
77
use std::str::FromStr;
88
use std::time::Duration;
@@ -126,27 +126,27 @@ pub trait Connection: Send {
126126
}
127127

128128
#[derive(Clone, Debug)]
129-
pub struct LogSettings {
130-
pub statements_level: LevelFilter,
131-
pub slow_statements_level: LevelFilter,
132-
pub slow_statements_duration: Duration,
129+
pub(crate) struct LogSettings {
130+
pub(crate) statements_level: LevelFilter,
131+
pub(crate) slow_statements_level: LevelFilter,
132+
pub(crate) slow_statements_duration: Duration,
133133
}
134134

135135
impl Default for LogSettings {
136136
fn default() -> Self {
137137
LogSettings {
138-
statements_level: LevelFilter::Debug,
138+
statements_level: LevelFilter::Info,
139139
slow_statements_level: LevelFilter::Warn,
140140
slow_statements_duration: Duration::from_secs(1),
141141
}
142142
}
143143
}
144144

145145
impl LogSettings {
146-
pub fn log_statements(&mut self, level: LevelFilter) {
146+
pub(crate) fn log_statements(&mut self, level: LevelFilter) {
147147
self.statements_level = level;
148148
}
149-
pub fn log_slow_statements(&mut self, level: LevelFilter, duration: Duration) {
149+
pub(crate) fn log_slow_statements(&mut self, level: LevelFilter, duration: Duration) {
150150
self.slow_statements_level = level;
151151
self.slow_statements_duration = duration;
152152
}

sqlx-core/src/mysql/options/mod.rs

-17
Original file line numberDiff line numberDiff line change
@@ -212,21 +212,4 @@ impl MySqlConnectOptions {
212212
self.collation = Some(collation.to_owned());
213213
self
214214
}
215-
216-
/// Sets the log settings.
217-
///
218-
/// # Example
219-
///
220-
/// ```rust
221-
/// # use sqlx_core::mysql::MySqlConnectOptions;
222-
/// let options = MySqlConnectOptions::new()
223-
/// .log_settings(sqlx_core::connection::LogSettings {
224-
/// statements_level: sqlx_core::connection::LevelFilter::Info,
225-
/// ..Default::default()
226-
/// });
227-
/// ```
228-
pub fn log_settings(mut self, log_settings: LogSettings) -> Self {
229-
self.log_settings = log_settings;
230-
self
231-
}
232215
}

sqlx-core/src/postgres/options/mod.rs

-17
Original file line numberDiff line numberDiff line change
@@ -319,23 +319,6 @@ impl PgConnectOptions {
319319
self
320320
}
321321

322-
/// Sets the log settings.
323-
///
324-
/// # Example
325-
///
326-
/// ```rust
327-
/// # use sqlx_core::postgres::PgConnectOptions;
328-
/// let options = PgConnectOptions::new()
329-
/// .log_settings(sqlx_core::connection::LogSettings {
330-
/// statements_level: sqlx_core::connection::LevelFilter::Info,
331-
/// ..Default::default()
332-
/// });
333-
/// ```
334-
pub fn log_settings(mut self, log_settings: LogSettings) -> Self {
335-
self.log_settings = log_settings;
336-
self
337-
}
338-
339322
/// We try using a socket if hostname starts with `/` or if socket parameter
340323
/// is specified.
341324
pub(crate) fn fetch_socket(&self) -> Option<String> {

sqlx-core/src/sqlite/options/mod.rs

-17
Original file line numberDiff line numberDiff line change
@@ -234,21 +234,4 @@ impl SqliteConnectOptions {
234234
self.immutable = immutable;
235235
self
236236
}
237-
238-
/// Sets the log settings.
239-
///
240-
/// # Example
241-
///
242-
/// ```rust
243-
/// # use sqlx_core::sqlite::SqliteConnectOptions;
244-
/// let options = SqliteConnectOptions::new()
245-
/// .log_settings(sqlx_core::connection::LogSettings {
246-
/// statements_level: sqlx_core::connection::LevelFilter::Info,
247-
/// ..Default::default()
248-
/// });
249-
/// ```
250-
pub fn log_settings(mut self, log_settings: LogSettings) -> Self {
251-
self.log_settings = log_settings;
252-
self
253-
}
254237
}

0 commit comments

Comments
 (0)