std::misc::logStructured logging for Hew programs.
import std::misc::log; Provides five log levels with structured key-value fields and automatic actor context injection.
fn main() {
log.setup();
log.info("server starting", port: 8080);
log.debug("cache initialized", capacity: 1024);
}
ERROR (0) > WARN (1) > INFO (2) > DEBUG (3) > TRACE (4)
Default: coloured text to stderr
12:34:56.789 INFO server starting port=8080
setupInitialize logging at the default INFO level.
setup_levelInitialize logging at a specific level.
Levels: 0=error, 1=warn, 2=info, 3=debug, 4=trace.
log.setup_level(3); // enable debug and above
set_levelSet the log level filter.
get_levelGet the current log level filter.
set_formatSet the log output format.
Use log.TEXT (0) for coloured text or log.JSON (1) for NDJSON.
log.set_format(log.JSON);
log.info("structured", service: "api");
get_formatGet the current log output format.
errorLog a message at error level (named args handled by compiler).
warnLog a message at warn level.
infoLog a message at info level.
debugLog a message at debug level.
traceLog a message at trace level.