From 01522e6478bb93a649db335839af1338513197e6 Mon Sep 17 00:00:00 2001 From: nadin-Starkware Date: Thu, 19 Dec 2024 17:04:13 +0200 Subject: [PATCH] feat: log the loaded configuration when the node starts running commit-id:17e3b0e2 --- Cargo.lock | 1 + crates/papyrus_config/Cargo.toml | 1 + crates/papyrus_config/src/loading.rs | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index b9468f7aad5..03a96feae40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7355,6 +7355,7 @@ dependencies = [ "strum_macros 0.25.3", "tempfile", "thiserror", + "tracing", "validator", ] diff --git a/crates/papyrus_config/Cargo.toml b/crates/papyrus_config/Cargo.toml index c5896100d25..addd9e52189 100644 --- a/crates/papyrus_config/Cargo.toml +++ b/crates/papyrus_config/Cargo.toml @@ -15,6 +15,7 @@ serde_json = { workspace = true, features = ["arbitrary_precision"] } strum_macros.workspace = true thiserror.workspace = true validator = { workspace = true, features = ["derive"] } +tracing.workspace = true [dev-dependencies] assert_matches.workspace = true diff --git a/crates/papyrus_config/src/loading.rs b/crates/papyrus_config/src/loading.rs index 50df585217f..943980c3922 100644 --- a/crates/papyrus_config/src/loading.rs +++ b/crates/papyrus_config/src/loading.rs @@ -14,7 +14,8 @@ use clap::Command; use command::{get_command_matches, update_config_map_by_command_args}; use itertools::any; use serde::Deserialize; -use serde_json::{json, Map, Value}; +use serde_json::{json, to_string_pretty, Map, Value}; +use tracing::info; use crate::validators::validate_path_exists; use crate::{ @@ -33,6 +34,11 @@ use crate::{ pub fn load Deserialize<'a>>( config_map: &BTreeMap, ) -> Result { + if let Ok(pretty_config) = to_string_pretty(&config_map) { + info!("config_map: {}", pretty_config); + } else { + info!("Failed to pretty-print config_map"); + } let mut nested_map = json!({}); for (param_path, value) in config_map { let mut entry = &mut nested_map;