tracing_web/
lib.rs

1//! A tracing compatible subscriber layer for web platforms.
2//!
3//! # Example usage
4//!
5//! ```rust, no_run
6//! use tracing_web::{MakeWebConsoleWriter, performance_layer};
7//! use tracing_subscriber::fmt::format::Pretty;
8//! use tracing_subscriber::fmt::time::UtcTime;
9//! use tracing_subscriber::prelude::*;
10//!
11//! let fmt_layer = tracing_subscriber::fmt::layer()
12//!     .with_ansi(false) // Only partially supported across browsers
13//!     .without_time()   // std::time is not available in browsers
14//!     .with_writer(MakeWebConsoleWriter::new()); // write events to the console
15//! let perf_layer = performance_layer().with_details_from_fields(Pretty::default());
16//!
17//! tracing_subscriber::registry()
18//!     .with(fmt_layer)
19//!     .with(perf_layer)
20//!     .init();
21//! ```
22
23#![deny(
24    missing_docs,
25    bare_trait_objects,
26    anonymous_parameters,
27    elided_lifetimes_in_paths
28)]
29
30mod performance_layer;
31pub use performance_layer::{
32    performance_layer, FormatSpan, FormatSpanFromFields, PerformanceEventsLayer,
33};
34mod console_writer;
35pub use console_writer::{ConsoleWriter, MakeConsoleWriter, MakeWebConsoleWriter};