mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Fix: RPC test failures (#7734)
Fixes #7735 Use `tracing::subscriber::set_default` to ensure that each test/thread has its own subscirber.
This commit is contained in:
committed by
GitHub
parent
c06ac81c67
commit
9c972201bc
@@ -72,12 +72,18 @@ impl std::ops::DerefMut for Libp2pInstance {
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub fn build_tracing_subscriber(level: &str, enabled: bool) {
|
||||
pub fn build_tracing_subscriber(
|
||||
level: &str,
|
||||
enabled: bool,
|
||||
) -> Option<tracing::subscriber::DefaultGuard> {
|
||||
if enabled {
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(EnvFilter::try_new(level).unwrap())
|
||||
.try_init()
|
||||
.unwrap();
|
||||
Some(tracing::subscriber::set_default(
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(EnvFilter::try_new(level).unwrap())
|
||||
.finish(),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user