A [tracing
] compatible subscriber layer for web platforms.
tracing-web
can be used in conjunction with the [tracing-subscriber
] crate to quickly install a
subscriber that emits messages to the dev-tools console, and events to the [Performance API]. An example
configuration can look like
```rust use tracingweb::{MakeConsoleWriter, performancelayer}; use tracingsubscriber::fmt::format::Pretty; use tracingsubscriber::fmt::time::UtcTime; use tracing_subscriber::prelude::*;
fn main() { let fmtlayer = tracingsubscriber::fmt::layer() .withansi(false) // Only partially supported across browsers .withtimer(UtcTime::rfc3339()) // std::time is not available in browsers .withwriter(MakeConsoleWriter); // write events to the console let perflayer = performancelayer() .withdetailsfrom_fields(Pretty::default());
tracing_subscriber::registry()
.with(fmt_layer)
.with(perf_layer)
.init(); // Install these as subscribers to tracing events
todo!("write your awesome application");
} ```
This project is dual licensed under the [MIT license] and the [Apache license].