diff --git a/src/builder.rs b/src/builder.rs index 04ee39244..d2ac84863 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -628,6 +628,7 @@ impl NodeBuilder { /// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options /// previously configured. pub fn build(&self, node_entropy: NodeEntropy) -> Result { + let logger = setup_logger(&self.log_writer_config, &self.config)?; let storage_dir_path = self.config.storage_dir_path.clone(); fs::create_dir_all(storage_dir_path.clone()) .map_err(|_| BuildError::StoragePathAccessFailed)?; @@ -636,18 +637,24 @@ impl NodeBuilder { Some(io::sqlite_store::SQLITE_DB_FILE_NAME.to_string()), Some(io::sqlite_store::KV_TABLE_NAME.to_string()), ) - .map_err(|_| BuildError::KVStoreSetupFailed)?; + .map_err(|e| { + log_error!(logger, "Failed to setup Sqlite store: {}", e); + BuildError::KVStoreSetupFailed + })?; self.build_with_store(node_entropy, kv_store) } /// Builds a [`Node`] instance with a [`FilesystemStore`] backend and according to the options /// previously configured. pub fn build_with_fs_store(&self, node_entropy: NodeEntropy) -> Result { + let logger = setup_logger(&self.log_writer_config, &self.config)?; let mut storage_dir_path: PathBuf = self.config.storage_dir_path.clone().into(); storage_dir_path.push("fs_store"); - fs::create_dir_all(storage_dir_path.clone()) - .map_err(|_| BuildError::StoragePathAccessFailed)?; + fs::create_dir_all(storage_dir_path.clone()).map_err(|e| { + log_error!(logger, "Failed to setup Filesystem store: {}", e); + BuildError::StoragePathAccessFailed + })?; let kv_store = FilesystemStore::new(storage_dir_path); self.build_with_store(node_entropy, kv_store) }