Skip to content

Commit 1b0b797

Browse files
committed
re-add using the env-filter for tracing/log messages in tests
1 parent 6685320 commit 1b0b797

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/test/mod.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use reqwest::{
1717
blocking::{Client, ClientBuilder, RequestBuilder, Response},
1818
Method,
1919
};
20-
use std::{fs, net::SocketAddr, panic, sync::Arc, time::Duration};
20+
use std::{fs, net::SocketAddr, panic, str::FromStr, sync::Arc, time::Duration};
2121
use tokio::runtime::Runtime;
2222
use tracing::{debug, error};
2323

@@ -206,9 +206,16 @@ pub(crate) struct TestEnvironment {
206206
}
207207

208208
pub(crate) fn init_logger() {
209+
use tracing_subscriber::{filter::Directive, EnvFilter};
210+
209211
rustwide::logging::init_with(tracing_log::LogTracer::new());
210212
let subscriber = tracing_subscriber::FmtSubscriber::builder()
211-
.with_max_level(tracing::Level::DEBUG)
213+
.with_env_filter(
214+
EnvFilter::builder()
215+
.with_default_directive(Directive::from_str("docs_rs=info").unwrap())
216+
.with_env_var("DOCSRS_LOG")
217+
.from_env_lossy(),
218+
)
212219
.with_test_writer()
213220
.finish();
214221
let _ = tracing::subscriber::set_global_default(subscriber);

0 commit comments

Comments
 (0)