Skip to content

Commit deff881

Browse files
committed
use TestWriter in test logging
1 parent c47f14c commit deff881

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/behaviour.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,10 +698,12 @@ mod tests {
698698
use libp2p::{PeerId, Swarm, Transport};
699699
use std::sync::{Arc, Mutex};
700700
use std::time::Duration;
701+
use tracing_subscriber::fmt::TestWriter;
701702

702703
fn tracing_try_init() {
703704
tracing_subscriber::fmt()
704705
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
706+
.with_writer(TestWriter::new())
705707
.try_init()
706708
.ok();
707709
}

src/query.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,12 @@ impl QueryManager {
504504
#[cfg(test)]
505505
mod tests {
506506
use super::*;
507+
use tracing_subscriber::fmt::TestWriter;
507508

508509
fn tracing_try_init() {
509510
tracing_subscriber::fmt()
510511
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
512+
.with_writer(TestWriter::new())
511513
.try_init()
512514
.ok();
513515
}

0 commit comments

Comments
 (0)