sheen ✨
A polished, colorful logging library for Rust ✨

Inspiration
sheen is inspired by charmbracelet/log, the excellent Go logging library. We wanted to bring the same polished experience to Rust.
Features
- Colorful, human-readable output
- Structured key=value logging
- Multiple formatters: Text, JSON, Logfmt
- Sub-loggers with persistent fields
- TTY detection (auto-disables colors when piped)
- Builder pattern configuration
- Zero config defaults
logcrate compatibility (optional feature flag)tracingcrate compatibility (optional feature flag)
Installation
[]
= "0.3"
With log crate support:
[]
= { = "0.3", = ["log"] }
With tracing crate support:
[]
= { = "0.3", = ["tracing"] }
Quick Start
Output:
14:32:15 INFO Server started port=3000
14:32:15 WARN Cache miss key="user_123"
14:32:15 ERROR Connection failed attempts=3
Custom Configuration
use ;
Sub-loggers
Create loggers with persistent fields using .with():
use ;
let logger = new.level;
let req_log = logger.with;
req_log.info;
req_log.info;
req_log.info;
Output:
14:32:15 INFO started request_id="abc123"
14:32:15 INFO db query request_id="abc123" table="users"
14:32:15 INFO completed request_id="abc123" status=200
Log Crate Integration
Enable the log feature to use sheen as a backend for the log crate. This captures logs from any dependency that uses log::info!(), log::warn!(), etc.
use ;
Tracing Crate Integration
Enable the tracing feature to use sheen as a subscriber for the tracing crate. This captures events from any dependency that uses tracing::info!(), tracing::warn!(), etc.
use ;
Formatters
Text (default)
Colorful, human-readable output:
let logger = new;
logger.info;
// 14:32:15 INFO hello port=3000
JSON
Structured output for log aggregators:
use ;
let logger = new.formatter;
logger.info;
// {"level":"info","msg":"hello","time":"14:32:15","port":3000}
Logfmt
Key=value format for Heroku, Splunk, etc:
use ;
let logger = new.formatter;
logger.info;
// level=info msg="hello" time="14:32:15" port=3000
TTY Detection
Colors are automatically disabled when output is piped:
# Colors enabled
# Colors disabled (piped to file)
Force colors on or off:
let logger = new.colorize;
License
MIT