feat: Introduce NodeBuilder (#5869)

Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
This commit is contained in:
Matthias Seitz
2023-12-28 17:01:32 +01:00
committed by GitHub
parent e341f47a16
commit a680a03658
12 changed files with 1721 additions and 851 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.