async_daemonize: Don't mix logs of different bins into the same file.

This commit is contained in:
Luther Blissett
2022-09-15 12:48:19 +02:00
parent d3d4edb23d
commit 03a35d19c1

View File

@@ -168,8 +168,13 @@ macro_rules! async_daemonize {
let log_file_path = match std::env::var("DARKFI_LOG") {
Ok(p) => p,
Err(_) => {
let bin_name = if let Some(bin_name) = option_env!("CARGO_BIN_NAME") {
bin_name
} else {
"darkfi"
};
std::fs::create_dir_all(expand_path("~/.local")?)?;
"~/.local/darkfi.log".into()
format!("~/.local/{}.log", bin_name)
}
};