lean-log
A zero-overhead logging framework for Rust with compile-time level filtering, structured logging, and minimal runtime cost.
Add to your project
[]
= "0.1"
Usage
use ;
Output goes to stderr with ANSI colour by default. To write to a file instead:
set_file_logging.unwrap;
// or append:
append_file_logging.unwrap;
Log levels
Off < Error < Warn < Notice < Info < Debug < Trace
Set at runtime with lean_log::set_level(Level::Debug) or via the RUST_LOG environment variable.
Compile-time level cap (features)
Enable only the levels you need to eliminate call sites entirely at compile time:
| Feature | Levels compiled in |
|---|---|
max_error |
Error only |
max_warn |
Error, Warn |
max_notice |
+ Notice |
max_info |
+ Info |
max_debug (default) |
+ Debug |
max_trace |
all levels |
disabled |
none (all calls removed) |
Structured fields
Append key=value fields after a ; separator:
info!; // Display
debug!; // Debug
License
MIT