Expand description
Structured logging pipeline for Rust.
log-io is an IO pipeline for structured log records. It is not a
wrapper around log or tracing. A record flows through a small
number of well-defined stages: filter, format, sink. Each stage is
independently composable.
§Quick start
use log_io::{Field, Level, Logger, Value};
let logger = Logger::builder()
.level(Level::Info)
.stdout_json()
.build();
logger.log(
Level::Info,
"server started",
&[Field::new("port", Value::U64(8080))],
);§Features
std(default): enables IO sinks, file output, async-safe locks, thread-local context propagation, and timestamps. When disabled, the crate compiles inno_stdmode with only the data model andcore::fmt::Write-based formatters available.json(default): JSON output format.logfmt(default):key=valuelogfmt output format.human(default): human-readable format with aligned columns and RFC 3339 timestamps.no_std-compatible.
§Design notes
The fast path is allocation-free in steady state. Record,
Field, and Value all borrow their data. Formatters
serialize directly into a writer; the built-in sinks use a
thread-local scratch buffer so per-record formatting does not
touch the allocator after the first call.
§Stability
1.x.y releases preserve backwards compatibility. The full public
API surface is documented in REPS.md section 4 and exhaustively
in docs/API.md.
Re-exports§
Modules§
Macros§
- debug
std - Emit a
crate::Level::Debugrecord. - error
std - Emit a
crate::Level::Errorrecord. - info
std - Emit a
crate::Level::Inforecord. - log_at
std - Emit a log record at the given level.
- trace
std - Emit a
crate::Level::Tracerecord. - warn
std - Emit a
crate::Level::Warnrecord.
Structs§
- Field
- A single key-value pair attached to a
Record. - Filter
std - A target-aware severity gate.
- Filter
Rule std - One rule in a
Filter. - Logger
std - The configured log pipeline.
- Logger
Builder std - Builder for
Logger. Construct withLogger::builder. - Metadata
- Metadata describing the origin and severity of a record.
- Parse
Filter Error std - Error returned by
Filter::parsewhen a directive segment is malformed. - Parse
Level Error - Error returned when a string cannot be parsed as a
Level. - Record
- A complete, immutable log record.
Enums§
- Error
std - Errors produced by the logging pipeline.
- Level
- Severity of a log record.
- Value
- A field value attached to a log record.
Constants§
- VERSION
- Crate version string, populated by Cargo at build time.
Type Aliases§
- Result
std - Crate result alias.