From 901d6fd5e33645a5da0e4d5b63a8072e120f5c54 Mon Sep 17 00:00:00 2001 From: macpie Date: Wed, 4 Sep 2024 10:52:07 -0700 Subject: [PATCH] Make sure that default is respected when `[custom_tracing]` is missing (#862) --- custom_tracing/src/settings.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/custom_tracing/src/settings.rs b/custom_tracing/src/settings.rs index d0fd86bb9..582e72768 100644 --- a/custom_tracing/src/settings.rs +++ b/custom_tracing/src/settings.rs @@ -1,12 +1,20 @@ use serde::{Deserialize, Serialize}; -#[derive(Debug, Serialize, Deserialize, Clone, Default)] +#[derive(Debug, Serialize, Deserialize, Clone)] pub struct Settings { /// File name to be watched by custom tracing #[serde(default = "default_tracing_cfg_file")] pub tracing_cfg_file: String, } +impl Default for Settings { + fn default() -> Self { + Self { + tracing_cfg_file: default_tracing_cfg_file(), + } + } +} + pub fn default_tracing_cfg_file() -> String { "tracing.cfg".to_string() }