Expand description
§wasm-tracing
Leverages tracing to proilfe wasm performance via console
.
§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
use console_error_panic_hook;
use wasm_bindgen::prelude::*;
#[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();
wasm_tracing::set_as_global_default();
Ok(())
}
Modules§
- prelude
- Re-exports of common types
Structs§
- Wasm
Layer - Implements tracing_subscriber::layer::Layer which uses wasm_bindgen for marking and measuring via
window.performance
andwindow.console
- Wasm
Layer Config - Configuration parameters for the WasmLayer.
Enums§
- Console
Config - Determines how the web console should behave
Functions§
- set_
as_ global_ default - Set the global default recorder with tracing::subscriber::set_global_default. Panics if the WasmLayer cannot be constructed.
- set_
as_ global_ default_ with_ config - Given a
WasmLayerConfig
, set WASM to be the default layer for a Registry. - try_
set_ as_ global_ default - Set WASM to be the default layer for a Registry via tracing::subscriber::set_global_default.