Skip to content

Commit c196552

Browse files
authored
tracing: Allow RUST_LOG usage in test mode (#5767)
1 parent 0fcd51e commit c196552

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/util/tracing.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ pub fn event_filter(metadata: &Metadata<'_>) -> EventFilter {
3939

4040
/// Initializes the `tracing` logging framework for usage in tests.
4141
pub fn init_for_test() {
42+
let env_filter = EnvFilter::builder()
43+
.with_default_directive(LevelFilter::INFO.into())
44+
.from_env_lossy();
45+
4246
let _ = tracing_subscriber::fmt()
4347
.compact()
44-
.with_max_level(tracing::Level::INFO)
48+
.with_env_filter(env_filter)
4549
.without_time()
4650
.with_test_writer()
4751
.try_init();

0 commit comments

Comments
 (0)