WASI 0.2 component (scaffold)
A component-model interface definition ships at
wit/rlg.wit — package rlg:core@0.0.11, world
rlg-logger. Consumable by any WASI 0.2 host (wasmtime run --component, jco, Fermyon Spin, …) once Phase 22.1 wires the
wit-bindgen codegen. See
docs/adr/0013-wasi-0.2-component.md.
Install
[]
= "0.0.11"
Requires Rust 1.88.0 or newer (edition 2024). For the wasm32 target, install wasm-pack as shown below.
Build a WASM bundle
The pkg/ output contains the JS shims, TypeScript types, and the
.wasm artifact.
Browser / Deno / Bun usage
import init from "./pkg/rlg_wasm.js";
await ;
const rlg = ;
rlg.;
rlg.;
rlg.;
Records render in the chosen LogFormat and dispatch to the host's
console.log / console.warn / console.error based on the level.
Cloudflare Workers
# wrangler.toml
= "my-worker"
= "src/index.js"
= "2026-05-30"
[]
= "wasm-pack build --target web"
// src/index.js
import init from "../pkg/rlg_wasm.js";
import wasm from "../pkg/rlg_wasm_bg.wasm";
let rlg;
export default ;
Supported formats
All 14 LogFormat variants: CLF, CEF, ELF, W3C,
ApacheAccessLog, Log4jXML, JSON, GELF, Logstash, NDJSON,
MCP, OTLP, Logfmt, ECS. Pass the variant name as the second
constructor argument.
License
Dual-licensed under Apache 2.0 or MIT, at your option.