Skip to main content

resolve_log_dir

Function resolve_log_dir 

Source
pub fn resolve_log_dir<G, C>(service: &str, get: G, can_create: C) -> PathBuf
where G: Fn(&str) -> Option<String>, C: Fn(&Path) -> bool,
Expand description

Resolve the log directory for service from an injected env-getter and a dir-creatable probe.

get reads an env var (None/blank = unset). can_create answers “can this exact directory be created and written?” — the caller wires it to the real filesystem in log_dir, and tests inject a closure to exercise the machine-root vs dev-fallback branch deterministically.