Skip to content

Commit 08f4d82

Browse files
committed
refactor(persistence): simplify logging when opening a sqlite connection
By adding the list of connection options used in the 'open' log message instead of doing a log for each option.
1 parent 379fbd1 commit 08f4d82

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

internal/mithril-persistence/src/sqlite/connection_builder.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl ConnectionBuilder {
8181
pub fn build(self) -> StdResult<ConnectionThreadSafe> {
8282
let logger = self.base_logger.new_with_component_name::<Self>();
8383

84-
debug!(logger, "Opening SQLite connection"; "path" => self.connection_path.display());
84+
debug!(logger, "Opening SQLite connection"; "path" => self.connection_path.display(), "options" => ?self.options);
8585
let connection =
8686
Connection::open_thread_safe(&self.connection_path).with_context(|| {
8787
format!(
@@ -94,14 +94,12 @@ impl ConnectionBuilder {
9494
.options
9595
.contains(&ConnectionOptions::EnableWriteAheadLog)
9696
{
97-
debug!(logger, "Enabling SQLite Write Ahead Log journal mode");
9897
connection
9998
.execute("pragma journal_mode = wal; pragma synchronous = normal;")
10099
.with_context(|| "SQLite initialization: could not enable WAL.")?;
101100
}
102101

103102
if self.options.contains(&ConnectionOptions::EnableForeignKeys) {
104-
debug!(logger, "Enabling SQLite foreign key support");
105103
connection
106104
.execute("pragma foreign_keys=true")
107105
.with_context(|| "SQLite initialization: could not enable FOREIGN KEY support.")?;
@@ -113,7 +111,6 @@ impl ConnectionBuilder {
113111
.options
114112
.contains(&ConnectionOptions::ForceDisableForeignKeys)
115113
{
116-
debug!(logger, "Force disabling SQLite foreign key support");
117114
connection
118115
.execute("pragma foreign_keys=false")
119116
.with_context(|| "SQLite initialization: could not disable FOREIGN KEY support.")?;

0 commit comments

Comments
 (0)