Skip to content

Commit

Permalink
Make sure that default is respected when [custom_tracing] is missing (
Browse files Browse the repository at this point in the history
  • Loading branch information
macpie authored Sep 4, 2024
1 parent d83d65b commit 901d6fd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion custom_tracing/src/settings.rs
Original file line number Diff line number Diff line change
@@ -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()
}

0 comments on commit 901d6fd

Please sign in to comment.