3 unstable releases

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

#163 in Debugging

Download history 24691/week @ 2024-07-21 26723/week @ 2024-07-28 22702/week @ 2024-08-04 24110/week @ 2024-08-11 24635/week @ 2024-08-18 26586/week @ 2024-08-25 26384/week @ 2024-09-01 22972/week @ 2024-09-08 19994/week @ 2024-09-15 23527/week @ 2024-09-22 21536/week @ 2024-09-29 21815/week @ 2024-10-06 22069/week @ 2024-10-13 21369/week @ 2024-10-20 19547/week @ 2024-10-27 20648/week @ 2024-11-03

84,610 downloads per month
Used in 1,311 crates (40 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
~56K SLoC