Skip to content

Commit

Permalink
Reduce log level when preference and history files not found
Browse files Browse the repository at this point in the history
  • Loading branch information
shartrec committed Jul 4, 2024
1 parent 0fd8c57 commit 71e8e7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use std::path::PathBuf;
use std::sync::RwLock;

use lazy_static::lazy_static;
use log::{error, warn};
use log::{info, warn};
use serde::{Deserialize, Serialize};

static HISTORY_FILE: &str = "rusty-calc-history.json";
Expand All @@ -46,7 +46,8 @@ static ref HISTORY_MANAGER: HistoryManager = {
serde_json::from_str(&contents).unwrap_or(History::new(HISTORY_SIZE))
}
Err(e) => {
error!("Unable to open history file: {}", e);
warn!("Unable to open history file: {}", e);
info!("A new history file will be created");
History::new(HISTORY_SIZE)
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/ui/preferences.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use std::{
};

use lazy_static::lazy_static;
use log::error;
use log::{error, info, warn};
use preferences::{AppInfo, Preferences, PreferencesMap};

static PREFS_PATH: &str = "rusty-calc.config";
Expand All @@ -47,7 +47,8 @@ lazy_static! {
match PreferencesMap::<String>::load(&APP_INFO, PREFS_PATH) {
Ok(map) => Arc::new(RwLock::new(map)),
Err(e) => {
error!("Error opening preferences {}", e);
warn!("Error opening preferences {}", e);
info!("A new preferences file will be created");
Arc::new(RwLock::new(PreferencesMap::new()))
}
}
Expand Down

0 comments on commit 71e8e7c

Please sign in to comment.