From baa060a9947f0006a256acdac075691da4168edf Mon Sep 17 00:00:00 2001 From: rezural Date: Mon, 21 Jun 2021 09:33:57 +1000 Subject: output to log file if RA_LOG_FILE is defined in environment --- crates/rust-analyzer/src/bin/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs index afc96505f..97246cae6 100644 --- a/crates/rust-analyzer/src/bin/main.rs +++ b/crates/rust-analyzer/src/bin/main.rs @@ -60,7 +60,14 @@ fn try_main() -> Result<()> { } } - setup_logging(flags.log_file.as_deref(), flags.no_log_buffering)?; + let mut log_file = flags.log_file.as_deref(); + + let env_log_file = env::var("RA_LOG_FILE").ok(); + if let Some(env_log_file) = env_log_file.as_deref() { + log_file = Some(Path::new(env_log_file)); + } + + setup_logging(log_file, flags.no_log_buffering)?; let verbosity = flags.verbosity(); match flags.subcommand { -- cgit v1.2.3