Logging and Notifications
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user