3 unstable releases

0.2.1 Nov 7, 2021
0.2.0 Feb 26, 2021
0.1.0 Jul 11, 2020

#83 in Debugging

Download history 10887/week @ 2023-11-21 11155/week @ 2023-11-28 10366/week @ 2023-12-05 11752/week @ 2023-12-12 9762/week @ 2023-12-19 7002/week @ 2023-12-26 11082/week @ 2024-01-02 12415/week @ 2024-01-09 13098/week @ 2024-01-16 14194/week @ 2024-01-23 14961/week @ 2024-01-30 14689/week @ 2024-02-06 15799/week @ 2024-02-13 20027/week @ 2024-02-20 16821/week @ 2024-02-27 15747/week @ 2024-03-05

71,400 downloads per month
Used in 968 crates (32 directly)

MIT/Apache

20KB
389 lines

tracing-wasm

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

Crates.io Documentation MIT licensed APACHE licensed

Screenshot of performance reported using the tracing-wasm Subscriber

Note: tracing_wasm 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 tracing_wasm 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:
    tracing_wasm::set_as_global_default();

    Ok(())
}

Dependencies

~2–3MB
~57K SLoC