diff --git a/Cargo.lock b/Cargo.lock index 089551d5..f66fef1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1601,7 +1601,6 @@ dependencies = [ name = "odilia-cache" version = "0.3.0" dependencies = [ - "async-trait", "atspi", "atspi-client", "atspi-common 0.5.0", @@ -1633,6 +1632,7 @@ dependencies = [ "serde_plain", "smartstring", "thiserror", + "xdg", "zbus", ] diff --git a/common/Cargo.toml b/common/Cargo.toml index 65ca163f..ffdbd648 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -21,3 +21,4 @@ thiserror = "1.0.37" zbus.workspace = true serde_plain.workspace = true figment = "0.10.15" +xdg = "2.4.1" diff --git a/common/src/settings/log.rs b/common/src/settings/log.rs index d687f976..b717440f 100644 --- a/common/src/settings/log.rs +++ b/common/src/settings/log.rs @@ -1,6 +1,6 @@ +use serde::{Deserialize, Serialize}; use std::path::PathBuf; -use serde::{Deserialize, Serialize}; ///structure used for all the configurable options related to logging #[derive(Debug, Serialize, Deserialize)] #[allow(clippy::module_name_repetitions)] @@ -16,10 +16,14 @@ pub struct LogSettings { } impl Default for LogSettings { fn default() -> Self { - Self { - level: "info".to_owned(), - logger: LoggingKind::File("/var/log/odilia.log".into()), - } + let xdg_dirs = xdg::BaseDirectories::with_prefix("odilia").expect( + "unable to find the odilia config directory according to the xdg dirs specification", + ); + let log_path = xdg_dirs + .place_state_file("odilia.log") + .expect("unable to place log file"); + + Self { level: "info".to_owned(), logger: LoggingKind::File(log_path) } } }