From 8b1e667077b043feba46e70ec1a3c88e7923e717 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Mon, 17 Dec 2018 17:22:30 -0500 Subject: By default, log only to stderr, and not to disk. This fixes a common problem when running under VS Code, the user doesn't have permissions to create a `log` directory in the CWD. The old behavior can be re-enabled by setting RA_INTERNAL_MODE=1 --- crates/ra_lsp_server/src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_lsp_server/src') diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs index 9ba972562..4497980e5 100644 --- a/crates/ra_lsp_server/src/main.rs +++ b/crates/ra_lsp_server/src/main.rs @@ -6,11 +6,11 @@ use ra_lsp_server::Result; fn main() -> Result<()> { ::std::env::set_var("RUST_BACKTRACE", "short"); - Logger::with_env_or_str("error") - .duplicate_to_stderr(Duplicate::All) - .log_to_file() - .directory("log") - .start()?; + let logger = Logger::with_env_or_str("error").duplicate_to_stderr(Duplicate::All); + match ::std::env::var("RA_INTERNAL_MODE") { + Ok(ref v) if v == "1" => logger.log_to_file().directory("log").start()?, + _ => logger.start()?, + }; log::info!("lifecycle: server started"); match ::std::panic::catch_unwind(main_inner) { Ok(res) => { -- cgit v1.2.3