Logging and Notifications

This commit is contained in:
2024-10-17 12:49:56 +02:00
parent 4e8ef3c0b4
commit 4c88ca0685
10 changed files with 247 additions and 35 deletions

View File

@@ -40,4 +40,23 @@ impl Dirs {
c.push(".lock");
Ok(c)
}
#[cfg(not(debug_assertions))]
pub fn get_log_dir() -> Result<PathBuf, DirsError> {
let c = Self::get_config_dir()?;
let mut log_dir = c.parent().unwrap().to_path_buf();
log_dir.push("logs");
if !log_dir.exists() {
std::fs::create_dir_all(&log_dir)?;
}
Ok(log_dir.to_path_buf())
}
#[cfg(not(debug_assertions))]
pub fn get_log_file() -> Result<PathBuf, DirsError> {
let mut l = Self::get_log_dir()?;
l.push("avam.log");
Ok(l)
}
}