Auto merge of #15089 - Veykril:slow-test-logs, r=Veykril

fix: Use RA_LOG in slow tests logging infra again
This commit is contained in:
bors 2023-06-19 13:34:51 +00:00
commit 8eef45212b

View file

@ -13,6 +13,7 @@ use rust_analyzer::{config::Config, lsp_ext, main_loop};
use serde::Serialize; use serde::Serialize;
use serde_json::{json, to_string_pretty, Value}; use serde_json::{json, to_string_pretty, Value};
use test_utils::FixtureWithProjectMeta; use test_utils::FixtureWithProjectMeta;
use tracing_subscriber::{prelude::*, Layer};
use vfs::AbsPathBuf; use vfs::AbsPathBuf;
use crate::testdir::TestDir; use crate::testdir::TestDir;
@ -76,13 +77,11 @@ impl<'a> Project<'a> {
let tmp_dir = self.tmp_dir.unwrap_or_else(TestDir::new); let tmp_dir = self.tmp_dir.unwrap_or_else(TestDir::new);
static INIT: Once = Once::new(); static INIT: Once = Once::new();
INIT.call_once(|| { INIT.call_once(|| {
tracing_subscriber::fmt() let filter: tracing_subscriber::filter::Targets =
.with_test_writer() std::env::var("RA_LOG").ok().and_then(|it| it.parse().ok()).unwrap_or_default();
// FIXME: I am not smart enough to figure out how to use this with let layer =
// `tracing_subscriber::filter::Targets`. tracing_subscriber::fmt::Layer::new().with_test_writer().with_filter(filter);
// tracing_subscriber::Registry::default().with(layer).init();
// .with_env_filter(tracing_subscriber::EnvFilter::from_env("RA_LOG"))
.init();
profile::init_from(crate::PROFILE); profile::init_from(crate::PROFILE);
}); });