pub fn logs_dir() -> Option<PathBuf>Expand description
Returns the first logs directory as defined by LogsDirectory in the unit file.
If the environment variable LOGS_DIRECTORY is not set, it returns None.
If it is set, it returns the first path in the colon-separated list.
To get all paths, use logs_dirs.
ยงExamples
let logs_dir = systemd_directories::logs_dir().unwrap_or_default();The function returns Option<PathBuf> which can be used in if let statements to handle the case where the environment variable is not set.
if let Some(logs_dir) = systemd_directories::logs_dir() {
// --snip--
}