Skip to main content

Crate rlg_wasm

Crate rlg_wasm 

Source
Expand description

WebAssembly bindings for rlg.

Targets browser, Deno, Cloudflare Workers, Bun, and any host that loads wasm-bindgen-produced modules. The 14 rlg LogFormat variants are all available; records are rendered to a UTF-8 String and (under wasm32) dispatched to console.log / console.warn / console.error via the JavaScript bridge.

On non-wasm targets the bindings are still compilable — the JS dispatch is replaced by eprintln!, so the same code can be exercised in host-side unit tests.

§JavaScript usage

import init, { RlgWasm } from "rlg-wasm";
await init();
const rlg = new RlgWasm("worker", "JSON");
rlg.info("worker booted", '{"region":"eu-west-1"}');
rlg.error("db timeout", null);

Structs§

RlgWasm
Logger handle. Construct once per “channel” (logical service or component) and emit records through the level shortcuts.