diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-18 07:01:52 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-12-18 07:01:52 +0000 |
commit | 4a1ab869b7aaa38d55e8995ec1b49e72b55a5965 (patch) | |
tree | bd605bea1850df6cc592528c4ace5987fc7be948 | |
parent | fd22dbde20179192776a32e40b4f73f2df02c99e (diff) | |
parent | 8b1e667077b043feba46e70ec1a3c88e7923e717 (diff) |
Merge #284
284: By default, log only to stderr, and not to disk. r=matklad a=eminence
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`
Fixes #282
Co-authored-by: Andrew Chin <[email protected]>
-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) => { |