Rasant
Rasant is a lightweight, high performance and flexible Rust library for structured logging, inspired by the likes of zap and zerolog.
It offers nanosecond precision, stackable logging and outstanding performance: on modern systems, Rasant can process and dispatch logs to multiple sinks in tens of nanoseconds, being normally bottlenecked by I/O operations. Can't wait that long? There's built-in async support!


Main Features
- Minimal dependencies.
- Blazing fast performance, with zero allocations on most operations.
- Leveled, structured contextual logging with nanosecond precision.
- Simple API, with support for stacked logging.
- Thread safe.
- Highly cconfigurable log sinks.
- Text and JSON log output.
- Support for dynamic async logging with constant lock time.
Usage
Latest stable release is v0.5.0. To use it, add the rasant crate to your Cargo.toml file:
[]
= "0.5.0"
Rasant is under active development and on track for a v1.0.0 release. You may see small public API changes until then, but the library is otherwise stable and fully functional.
Getting started
Basic examples
Loggers can be easily initialized using sink defaults, and accessed via methods...
use rasant;
use ToValue;
let mut log = new;
log.add_sink.set_level;
log.set;
log.info;
log.warn_with;
log.debug;
...or the much nicer macro API:
use rasant as r;
let mut log = new;
log.add_sink.set_level;
set!;
info!;
warn!;
debug!;
2026-04-03 17:16:03.773 +0200 [INF] hello world! program_name="test"
2026-04-03 17:16:03.773 +0200 [WRN] here's some context program_name="test" line=7
Stacking
All loggers can be cheaply cloned, inheriting all settings from its parent - including
levels, sinks and fixed attributes - allowing for very flexible setups. For example, to
have all errors (or higher) within a thread logged to stderr:
use rasant as r;
use thread;
let mut log = new;
log.add_sink.set_level;
info!;
let mut thread_log = log.clone;
spawn;
Configuring Sinks
Sinks can be configured to tweak multiple parameters, including time and overall output format.
use ntime;
use rasant as r;
let mut log = new;
log.set_level.add_sink;
info!;
{"time":"2026-04-03 16:03:04.481888522","level":"info","message":"hello!"}
Asynchronous Logging
All loggers can dynamically enable/disable async writes.
When in async mode, log operations have a slightly longer (as details are copied into a queue) but fixed lock time, making it ideal f.ex. for logging into slow storage without compromising overall performance.
use rasant as r;
let mut log = new;
log.set_level.add_sink;
info!;
log.set_async;
info!;
warn!;
info!;
Documentation
To-Do's
Rasant is under active development, with more features planned for future versions.
- New output formants (hierarchical pretty print?)
- New sink types (f.ex. syslog)
- Binary output formats, such as CBOR and protobuf.
- Configurable log filters.
License
Rasant is distrubuted under the MIT license.