|
|
@@ -126,7 +126,7 @@ macro_rules! cli_desc {
|
|
|
/// async_daemonize, cli_desc,
|
|
|
/// util::{
|
|
|
/// cli::{get_log_config, get_log_level, spawn_config},
|
|
|
-/// path::get_config_path,
|
|
|
+/// path::get_config_path, expand_path
|
|
|
/// },
|
|
|
/// Result,
|
|
|
/// };
|
|
|
@@ -165,11 +165,14 @@ macro_rules! async_daemonize {
|
|
|
let log_level = get_log_level(args.verbose.into());
|
|
|
let log_config = get_log_config();
|
|
|
|
|
|
- let env_log_file_path = match std::env::var("DARKFI_LOG") {
|
|
|
- Ok(p) => std::fs::File::create(p).unwrap(),
|
|
|
- Err(_) => std::fs::File::create("/tmp/darkfi.log").unwrap(),
|
|
|
+ let log_file_path = match std::env::var("DARKFI_LOG") {
|
|
|
+ Ok(p) => p,
|
|
|
+ Err(_) => "~/.local/darkfi.log".into(),
|
|
|
};
|
|
|
|
|
|
+ let log_file_path = expand_path(&log_file_path)?;
|
|
|
+ let log_file = std::fs::File::create(log_file_path)?;
|
|
|
+
|
|
|
simplelog::CombinedLogger::init(vec![
|
|
|
simplelog::TermLogger::new(
|
|
|
log_level,
|
|
|
@@ -177,7 +180,7 @@ macro_rules! async_daemonize {
|
|
|
simplelog::TerminalMode::Mixed,
|
|
|
simplelog::ColorChoice::Auto,
|
|
|
),
|
|
|
- simplelog::WriteLogger::new(log_level, log_config, env_log_file_path),
|
|
|
+ simplelog::WriteLogger::new(log_level, log_config, log_file),
|
|
|
])?;
|
|
|
|
|
|
// https://docs.rs/smol/latest/smol/struct.Executor.html#examples
|