diff options
author | Andrew Chin <[email protected]> | 2018-12-17 22:22:30 +0000 |
---|---|---|
committer | Andrew Chin <[email protected]> | 2018-12-17 22:22:30 +0000 |
commit | 8b1e667077b043feba46e70ec1a3c88e7923e717 (patch) | |
tree | bb9eef06cd53f531acd2c2f3dbf9275f780e82c8 /crates | |
parent | 1875aa024f885f1d6119bff8aa828634b4941248 (diff) |
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
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_lsp_server/src/main.rs | 10 |
1 files changed, 5 insertions, 5 deletions
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; | |||
6 | 6 | ||
7 | fn main() -> Result<()> { | 7 | fn main() -> Result<()> { |
8 | ::std::env::set_var("RUST_BACKTRACE", "short"); | 8 | ::std::env::set_var("RUST_BACKTRACE", "short"); |
9 | Logger::with_env_or_str("error") | 9 | let logger = Logger::with_env_or_str("error").duplicate_to_stderr(Duplicate::All); |
10 | .duplicate_to_stderr(Duplicate::All) | 10 | match ::std::env::var("RA_INTERNAL_MODE") { |
11 | .log_to_file() | 11 | Ok(ref v) if v == "1" => logger.log_to_file().directory("log").start()?, |
12 | .directory("log") | 12 | _ => logger.start()?, |
13 | .start()?; | 13 | }; |
14 | log::info!("lifecycle: server started"); | 14 | log::info!("lifecycle: server started"); |
15 | match ::std::panic::catch_unwind(main_inner) { | 15 | match ::std::panic::catch_unwind(main_inner) { |
16 | Ok(res) => { | 16 | Ok(res) => { |