feat: Introduce NodeBuilder (#5824)

This commit is contained in:
Dan Cline
2023-12-27 07:56:20 -05:00
committed by GitHub
parent e861f2b463
commit 8e9b02f128
12 changed files with 1618 additions and 847 deletions

View File

@ -33,7 +33,8 @@ pub type BoxedLayer<S> = Box<dyn Layer<S> + Send + Sync>;
/// Initializes a new [Subscriber] based on the given layers.
pub fn init(layers: Vec<BoxedLayer<Registry>>) {
tracing_subscriber::registry().with(layers).init();
// To avoid panicking in tests, we silently fail if we cannot initialize the subscriber.
let _ = tracing_subscriber::registry().with(layers).try_init();
}
/// Builds a new tracing layer that writes to stdout.