Remove flexi_logger from ra_lsp_server

This commit is contained in:
Alexander Ekdahl 2019-11-29 19:35:03 -05:00
parent 9c01c0dcb5
commit eb4e70fc67
6 changed files with 5 additions and 73 deletions

View file

@ -8,6 +8,7 @@ publish = false
[dependencies]
pico-args = "0.3.0"
log = "0.4"
env_logger = { version = "0.7.1", default-features = false, features = ["humantime"] }
ra_syntax = { path = "../ra_syntax" }
ra_ide = { path = "../ra_ide" }
@ -19,8 +20,3 @@ ra_db = { path = "../ra_db" }
path = "../ra_prof"
# features = [ "cpu_profiler" ]
# features = [ "jemalloc" ]
[dependencies.env_logger]
version = "0.7.1"
default-features = false
features = ["humantime"]

View file

@ -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"

View file

@ -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),

View file

@ -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";

View file

@ -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 {