C+
Packages · v0.0.13

log

A leveled, structured logger that writes to stderr. Configure the level and colors once, then log at every call site. There is zero malloc per call: the ANSI escapes are static str, and the timestamp buffer and time_t slot live on the stack via #addr_of.

import "log/log" as log;

log::set_max_level(log::Level::Info);
log::set_use_colors(true);
log::info("server started on port 8080");
log::warn("config file missing; using defaults");

The call surface is log::trace, log::debug, log::info, log::warn, and log::error. It is single-threaded.