refine new implementation in comments
@@ -62,18 +62,22 @@ impl RawSettings {
pub fn log_settings(&self) -> LogSettings {
// FIXME: remove this after refactoring is done
// changing the flow for creating the LogSettings inner Vec to this:
- // * Read log settings from the config file path
- // * If no log settings are found:
- // + add LogSettingsEntry with default values
- // * If the command line specifies log arguments:
- // + Check that the arg is Some(output), else, skip
- // + Read the log settings, and look if we already
+ // * [X] Read log settings from the config file path
+ // * [X] If no log settings are found:
+ // + [X] add LogSettingsEntry with default values
+ // * [ ] If the command line specifies log arguments:
+ // + [X] Check that the arg is Some(output), else, skip
+ // + [ ] Read the log settings, and look if we already
// have this output configured
- // + If the output is aleady configured:
- // - overwrite entry.level if cli_entry.level is Some(level)
- // - overwrite entry.format if cli_entry.format is Some(format)
+ // + [ ] If the output is aleady configured:
+ // - [ ] overwrite entry.level if cli_entry.level is Some(level)
+ // - [ ] overwrite entry.format if cli_entry.format is Some(format)
+ // - [ ] log to info! that the output was overriden
+ // + [ ] If the output is not aleady configured:
+ // - [ ] add new entry for output with default values for other fields.
let mut entries = Vec::new();
+ // Read log settings from the config file path.
if let Some(log) = self.config.as_ref().and_then(|cfg| cfg.log.as_ref()) {
log.0.iter().for_each(|entry| {
entries.push(LogSettingsEntry {
@@ -96,6 +100,8 @@ impl RawSettings {
});
}
+ // If no log settings are found, add LogSettingsEntry with default
+ // values.
if entries.is_empty() {
entries.push(LogSettingsEntry {
level: DEFAULT_FILTER_LEVEL,
