From eb4e70fc676a97a7b411f372be1727df51a8906a Mon Sep 17 00:00:00 2001 From: Alexander Ekdahl Date: Fri, 29 Nov 2019 19:35:03 -0500 Subject: Remove flexi_logger from ra_lsp_server --- crates/ra_lsp_server/Cargo.toml | 2 +- crates/ra_lsp_server/src/main.rs | 7 +------ crates/ra_lsp_server/tests/heavy_tests/main.rs | 1 - crates/ra_lsp_server/tests/heavy_tests/support.rs | 3 +-- 4 files changed, 3 insertions(+), 10 deletions(-) (limited to 'crates/ra_lsp_server') diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml index 21aef842c..41672eaff 100644 --- a/crates/ra_lsp_server/Cargo.toml +++ b/crates/ra_lsp_server/Cargo.toml @@ -13,7 +13,6 @@ relative-path = "1.0.0" serde_json = "1.0.34" serde = { version = "1.0.83", features = ["derive"] } crossbeam-channel = "0.4" -flexi_logger = "0.14.0" log = "0.4.3" lsp-types = { version = "0.61.0", features = ["proposed"] } rustc-hash = "1.0" @@ -27,6 +26,7 @@ lsp-server = "0.3.0" ra_project_model = { path = "../ra_project_model" } ra_prof = { path = "../ra_prof" } ra_vfs_glob = { path = "../ra_vfs_glob" } +env_logger = { version = "0.7.1", default-features = false, features = ["humantime"] } [dev-dependencies] tempfile = "3" diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs index e13c8ca14..8076a7fa5 100644 --- a/crates/ra_lsp_server/src/main.rs +++ b/crates/ra_lsp_server/src/main.rs @@ -1,6 +1,5 @@ //! `ra_lsp_server` binary -use flexi_logger::{Duplicate, Logger}; use lsp_server::Connection; use ra_lsp_server::{show_message, Result, ServerConfig}; use ra_prof; @@ -14,11 +13,7 @@ fn main() -> Result<()> { fn setup_logging() -> Result<()> { std::env::set_var("RUST_BACKTRACE", "short"); - let logger = Logger::with_env_or_str("error").duplicate_to_stderr(Duplicate::All); - match std::env::var("RA_LOG_DIR") { - Ok(ref v) if v == "1" => logger.log_to_file().directory("log").start()?, - _ => logger.start()?, - }; + env_logger::try_init()?; ra_prof::set_filter(match std::env::var("RA_PROFILE") { Ok(spec) => ra_prof::Filter::from_spec(&spec), diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs index 2ba82ab05..29224cbe8 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/main.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs @@ -15,7 +15,6 @@ use tempfile::TempDir; use crate::support::{project, Project}; -const LOG: &'static str = ""; const PROFILE: &'static str = ""; // const PROFILE: &'static str = "*@3>100"; diff --git a/crates/ra_lsp_server/tests/heavy_tests/support.rs b/crates/ra_lsp_server/tests/heavy_tests/support.rs index 86073b57d..d5ea52fa9 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/support.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/support.rs @@ -7,7 +7,6 @@ use std::{ }; use crossbeam_channel::{after, select, Receiver}; -use flexi_logger::Logger; use lsp_server::{Connection, Message, Notification, Request}; use lsp_types::{ notification::{DidOpenTextDocument, Exit}, @@ -53,7 +52,7 @@ impl<'a> Project<'a> { let tmp_dir = self.tmp_dir.unwrap_or_else(|| TempDir::new().unwrap()); static INIT: Once = Once::new(); INIT.call_once(|| { - let _ = Logger::with_env_or_str(crate::LOG).start().unwrap(); + let _ = env_logger::builder().is_test(true).try_init().unwrap(); ra_prof::set_filter(if crate::PROFILE.is_empty() { ra_prof::Filter::disabled() } else { -- cgit v1.2.3