From 3f6f82b0c4c826df49dc7d37659257943975f67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Fri, 19 Feb 2021 16:48:51 +0900 Subject: [PATCH] Always store the log file under home dir. --- Cargo.lock | 1 + helix-term/Cargo.toml | 2 ++ helix-term/src/helix.log | 0 helix-term/src/main.rs | 4 +++- helix-term/src/ui/helix.log | 0 5 files changed, 6 insertions(+), 1 deletion(-) delete mode 100644 helix-term/src/helix.log delete mode 100644 helix-term/src/ui/helix.log diff --git a/Cargo.lock b/Cargo.lock index 59008225b..20d53d1a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -592,6 +592,7 @@ dependencies = [ "chrono", "clap", "crossterm", + "dirs-next", "fern", "futures-util", "fuzzy-matcher", diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index 40efa58e5..e410c6c41 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -37,3 +37,5 @@ log = "0.4" # File picker fuzzy-matcher = "0.3" ignore = "0.4" +# shellexpand = "2.1" +dirs-next = "2.0" diff --git a/helix-term/src/helix.log b/helix-term/src/helix.log deleted file mode 100644 index e69de29bb..000000000 diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index cdaa39247..84b52ea2b 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -31,6 +31,8 @@ fn setup_logging(verbosity: u64) -> Result<(), fern::InitError> { _3_or_more => base_config.level(log::LevelFilter::Trace), }; + let home = dirs_next::home_dir().expect("can't find the home directory"); + // Separate file config so we can include year, month and day in file logs let file_config = fern::Dispatch::new() .format(|out, message, record| { @@ -42,7 +44,7 @@ fn setup_logging(verbosity: u64) -> Result<(), fern::InitError> { message )) }) - .chain(fern::log_file("helix.log")?); + .chain(fern::log_file(home.join("helix.log"))?); base_config.chain(file_config).apply()?; diff --git a/helix-term/src/ui/helix.log b/helix-term/src/ui/helix.log deleted file mode 100644 index e69de29bb..000000000