Skip to main content

Module logger

Module logger 

Source
Expand description

The native binary’s log sink (main.rs): RUST_LOG to stderr. Replaces env_logger; the wasm build logs through the browser console instead. The native binary’s log sink: RUST_LOG-filtered lines to stderr.

This exists so the warnings eframe, winit and wgpu emit through the log facade reach the terminal — the app itself logs three lines. It replaces env_logger, which cost twelve crates for that: a full regex, jiff + jiff-core (a date library, for timestamps we never print) and the anstream/anstyle/colorchoice colour stack.

What it keeps of env_logger’s behaviour: the RUST_LOG variable, its comma-separated level / target=level directives (longest matching target prefix wins, exactly as env_logger resolves them), the Error default when RUST_LOG is unset or unparseable, and the [LEVEL target] message line shape. What it drops: colour, timestamps, and regex message filters (RUST_LOG=…/pattern) — none of which this binary ever asked for. A / suffix is parsed off and ignored rather than misread as part of a target.

Native only: the wasm build logs through the browser console.

Functions§

try_init
Install the logger. Mirrors env_logger::try_init: Err if some other logger is already installed, and the caller is free to ignore that.