🪓 lumbermill
Simple structured logging.

Usage
use
The trace!, debug!, info!, warn!, error! & fatal! are heavily inspired
by tracing's macros because they're good.
The default logger prints pretty logs to stdout only, but you can configure the Logger to behave differently:
use ;
builder
.format // Set the format of logs
.level // Set the minimum log level
.stdout // Stop printing to stdout
.file // Log to a directory; one file per day
// Shorthands
.pretty // .format(LogFormat::Pretty)
.compact // .format(LogFormat::Compact)
.pretty_structured // .format(LogFormat::PrettyStructured)
.json // .format(LogFormat::Json)
// Remember to call `init` after configuration!
.init;
You can have different active configurations in different scenarios by using the
#![cfg] macro:
// Pretty logs on stdout during development
default.level.pretty.init;
// Compact logs on rolling files in production
Examples
Examples are a good entrypoint to learn about the library. Run them this way:
Docs usually go into more detail once you get the hang of things.
Why?
The tracing ecosystem is awesome, but it's also overkill for a lot of apps who
only need structured logging and not a distributed tracing solution. The log crate
is the obvious alternative, but its kv module is a work-in-progress.
You are also unable to log key-value pairs that do not implement Display in
a incovenient way.
This crate is a stop-gap till log::kv stabilizes. It marries tracing's awesome
event! macro to log's simplicity. The plan is to eventually drop the custom
macros in this crate and integrate with log directly.
MSRV
This crate currently requires at least Rust 1.70