feat: add is_show_debug_output

This commit is contained in:
2020-10-18 22:50:22 +08:00
parent 40748eb3bb
commit acd45e75f6

View File

@@ -18,6 +18,12 @@ struct KeepRunningConfig {
items: Vec<KeepRunningConfigItem>,
}
impl KeepRunningConfig {
fn is_show_debug_output(&self) -> bool {
self.show_debug_output.unwrap_or(false)
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
struct KeepRunningConfigItem {
title: String,
@@ -96,7 +102,7 @@ fn parse_keep_running_config() -> Option<KeepRunningConfig> {
},
};
if keep_running_config.show_debug_output.unwrap_or(false) {
if keep_running_config.is_show_debug_output() {
if let Ok(json) = serde_json::to_string_pretty(&keep_running_config) {
debug!("Config: {}", json);
}
@@ -137,7 +143,7 @@ fn keep_runningd(keep_running_config: Arc<KeepRunningConfig>) {
},
_ => ( /* IGNORE */ ),
}
} else if keep_running_config.show_debug_output.unwrap_or(false) {
} else if keep_running_config.is_show_debug_output() {
debug!("Find: {:?}", &check_lines);
}
}