@@ -4,9 +4,8 @@ use helix_loader::VERSION_AND_GIT_HASH;
4use helix_term::application::Application;
4use helix_term::application::Application;
5use helix_term::args::Args;
5use helix_term::args::Args;
6use helix_term::config::{Config, ConfigLoadError};
6use helix_term::config::{Config, ConfigLoadError};
7−use std::path::PathBuf;
9−fn setup_logging(logpath: PathBuf, verbosity: u64) -> Result<()> {
8+fn setup_logging(verbosity: u64) -> Result<()> {
10 let mut base_config = fern::Dispatch::new();
9 let mut base_config = fern::Dispatch::new();
12 base_config = match verbosity {
11 base_config = match verbosity {
@@ -27,7 +26,7 @@ fn setup_logging(logpath: PathBuf, verbosity: u64) -> Result<()> {
30− .chain(fern::log_file(logpath)?);
29+ .chain(fern::log_file(helix_loader::log_file())?);
32 base_config.chain(file_config).apply()?;
31 base_config.chain(file_config).apply()?;
@@ -41,12 +40,6 @@ fn main() -> Result<()> {
42#[tokio::main]
41#[tokio::main]
43async fn main_impl() -> Result<i32> {
42async fn main_impl() -> Result<i32> {
44− let logpath = helix_loader::log_file();
45− let parent = logpath.parent().unwrap();
46− if !parent.exists() {
47− std::fs::create_dir_all(parent).ok();
50 let help = format!(
43 let help = format!(
@@ -78,7 +71,7 @@ FLAGS:
78 VERSION_AND_GIT_HASH,
71 VERSION_AND_GIT_HASH,
79 env!("CARGO_PKG_AUTHORS"),
72 env!("CARGO_PKG_AUTHORS"),
80 env!("CARGO_PKG_DESCRIPTION"),
73 env!("CARGO_PKG_DESCRIPTION"),
81− logpath.display(),
74+ helix_loader::default_log_file().display(),
84 let args = Args::parse_args().context("could not parse arguments")?;
77 let args = Args::parse_args().context("could not parse arguments")?;
@@ -116,15 +109,10 @@ FLAGS:
116 return Ok(0);
109 return Ok(0);
119− let logpath = args.log_file.as_ref().cloned().unwrap_or(logpath);
120− setup_logging(logpath, args.verbosity).context("failed to initialize logging")?;
122− let config_dir = helix_loader::config_dir();
123− if !config_dir.exists() {
124− std::fs::create_dir_all(&config_dir).ok();
127 helix_loader::initialize_config_file(args.config_file.clone());
112 helix_loader::initialize_config_file(args.config_file.clone());
113+ helix_loader::initialize_log_file(args.log_file.clone());
115+ setup_logging(args.verbosity).context("failed to initialize logging")?;
129 let config = match Config::load_default() {
117 let config = match Config::load_default() {
130 Ok(config) => config,
118 Ok(config) => config,