#tracing-subscriber #tracing #logging #metrics #spans #version

no-std wasm-tracing

Tracing subscriber for WebAssembly. Maintained fork of tracing-wasm.

3 unstable releases

0.2.1 Sep 4, 2024
0.2.0 Sep 4, 2024
0.1.0 Sep 4, 2024

#202 in WebAssembly

Download history 176/week @ 2024-08-29 127/week @ 2024-09-05 36/week @ 2024-09-12 19/week @ 2024-09-19 28/week @ 2024-09-26 17/week @ 2024-10-03 8/week @ 2024-10-10 139/week @ 2024-10-17 376/week @ 2024-10-24 21/week @ 2024-10-31 1378/week @ 2024-11-07 399/week @ 2024-11-14 498/week @ 2024-11-21 134/week @ 2024-11-28

2,415 downloads per month
Used in moq-web

MIT/Apache

23KB
433 lines

wasm-tracing

A maintained fork of tracing-wasm that is compatible with the latest tracing and wasm-bindgen versions.

Leverage performance profiling with your browser tools with the tracing crate.

Crates.io Documentation MIT licensed APACHE licensed

Note: wasm_tracing uses the global JavaScript console and performance objects. It will not work in environments where one or both of these are not available, such as Node.js or Cloudflare Workers.

Usage

For the simplest out of the box set-up, you can simply set wasm_tracing as your default tracing Subscriber in wasm_bindgen(start)

We have this declared in our ./src/lib.rs

#[wasm_bindgen(start)]
pub fn start() -> Result<(), JsValue> {
    // print pretty errors in wasm https://github.com/rustwasm/console_error_panic_hook
    // This is not needed for tracing_wasm to work, but it is a common tool for getting proper error line numbers for panics.
    console_error_panic_hook::set_once();

    // Add this line:
    wasm_tracing::set_as_global_default();

    Ok(())
}

Dependencies

~2–3MB
~55K SLoC