Function set_as_global_default_with_config

Source
pub fn set_as_global_default_with_config(
    config: WasmLayerConfig,
) -> Result<(), SetGlobalDefaultError>
Expand description

Given a WasmLayerConfig, set WASM to be the default layer for a Registry.

ยงExample

use console_error_panic_hook;
use wasm_bindgen::prelude::*;
use wasm_tracing::prelude::*;
use tracing::Level;

#[wasm_bindgen(start)]
pub fn start() -> Result<(), JsValue> {
    console_error_panic_hook::set_once();

    let config = WasmLayerConfig::new().set_report_logs_in_timings(true).set_max_level(Level::ERROR).to_owned();

    let _ = wasm_tracing::set_as_global_default_with_config(config);

    Ok(())
}