diff --git a/CHANGELOG.md b/CHANGELOG.md index 93d4e31b..8fba505c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - ReleaseDate ### Fixed - supervisor: deadlock if a router returns `Outcome::Multicast` ([#105]). +- supervisor: print the system config, not only the custom one. [#105]: https://github.com/elfo-rs/elfo/pull/105 diff --git a/elfo-core/src/config.rs b/elfo-core/src/config.rs index a408bd1d..98e906dc 100644 --- a/elfo-core/src/config.rs +++ b/elfo-core/src/config.rs @@ -156,7 +156,7 @@ impl<'de> Deserializer<'de> for AnyConfig { // === SystemConfig === -#[derive(Default, Deserialize)] +#[derive(Debug, Default, Deserialize)] #[serde(default)] pub(crate) struct SystemConfig { pub(crate) logging: crate::logging::LoggingConfig, diff --git a/elfo-core/src/dumping/config.rs b/elfo-core/src/dumping/config.rs index 9c391e49..f8503c41 100644 --- a/elfo-core/src/dumping/config.rs +++ b/elfo-core/src/dumping/config.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -#[derive(Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize)] #[serde(default)] pub(crate) struct DumpingConfig { pub(crate) disabled: bool, diff --git a/elfo-core/src/logging/config.rs b/elfo-core/src/logging/config.rs index ca2d623b..070f0fee 100644 --- a/elfo-core/src/logging/config.rs +++ b/elfo-core/src/logging/config.rs @@ -1,7 +1,7 @@ use serde::{Deserialize, Deserializer}; use tracing::level_filters::LevelFilter; -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] #[serde(default)] pub(crate) struct LoggingConfig { #[serde(deserialize_with = "deserialize_level_filter")] diff --git a/elfo-core/src/supervisor.rs b/elfo-core/src/supervisor.rs index 0d801315..aef1bae7 100644 --- a/elfo-core/src/supervisor.rs +++ b/elfo-core/src/supervisor.rs @@ -426,7 +426,14 @@ where control.user_config = Some(config.get_user::().clone()); self.router .update(control.user_config.as_ref().expect("just saved")); - self.in_scope(|| info!(config = ?control.user_config.as_ref().unwrap(), "router updated")); + + self.in_scope(|| { + debug!( + message = "config updated", + system = ?control.system_config, + custom = ?control.user_config.as_ref().unwrap(), + ) + }); } fn subscribe_to_statuses(&self, addr: Addr, forcing: bool) { diff --git a/elfo-core/src/telemetry/config.rs b/elfo-core/src/telemetry/config.rs index 852862ac..5780f11c 100644 --- a/elfo-core/src/telemetry/config.rs +++ b/elfo-core/src/telemetry/config.rs @@ -1,10 +1,12 @@ +use std::fmt; + use regex::Regex; use serde::{ de::{Deserializer, Error}, Deserialize, }; -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] #[serde(default)] pub(crate) struct TelemetryConfig { pub(crate) per_actor_group: bool, @@ -16,6 +18,19 @@ pub(crate) enum PerActorKey { Replacement(Regex, String), } +impl fmt::Debug for PerActorKey { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Bool(flag) => write!(f, "{:?}", flag), + Self::Replacement(pattern, template) => f + .debug_tuple("") + .field(&pattern.as_str()) + .field(&template) + .finish(), + } + } +} + impl PerActorKey { pub(crate) fn is_enabled(&self) -> bool { match self {