Reference · reference

log module

1 min read · 2026-09-02 · config-weave 0.1.0

use log gives a script structured logging. Every message carries the context of the step that emitted it into the terminal output and the NDJSON file log. Raw print and println calls are redirected into log::info, so stdout stays clean for --json. shell::run_streaming in the shell module pipes a long command's output through this module live. All four functions are available on every platform and none of them fails.

debug, info, warn and error

rust
log::debug(message: string)
log::info(message: string)
log::warn(message: string)
log::error(message: string)

Each function emits one message at its level. The terminal shows messages at or above the verbosity selected with -v. The file log uses its own level, set with --log-level, so a debug message can reach the file without reaching the terminal.

FunctionLevelTypical use
debugdebugvalues a script inspected while deciding
infoinfoprogress a reader wants to see
warnwarnsomething unexpected that the step tolerated
errorerrora failure the step is about to report
rust
use log

log::info("package cache refreshed")
log::warn("config file was regenerated")