slog
is an ecosystem of reusable components for structured, composable logging
for Rust.
The ambition is to be The Logging Framework for Rust. slog
should accommodate
variety of logging features and requirements.
#![no_std]
support (with opt-out std
cargo feature flag)log
crate (slog-stdlog
crate)
crates/example-lib
log
crate)slog-envlogger
- port of env_logger
slog-term
crate)slog-json
crate)
slog-bunyan
crate)slog-syslog
crate)log
crateslog
provides core functionality, and some standard
feature-set. But using traits, anyone can easily implement as
powerful fully-custom features, publish separately and grow slog
feature-set
for everyone.env_logger
, but output authentication messages to syslog,
while reporting errors over network in json format? With slog
drains can
reuse other drains! You can combine them together, chain, wrap - you name it.log
you would have to repeat this information in
every log statement. In slog
it will happen automatically. See
slog-rs functional overview page to understand better
logger and drain hierarchies and log record flow through them.Async
drain, and closures
to make your logging fast.AtomicSwitch
drain allows
changing logging behavior in the running program. You could use eg. signal
handlers to change logging level or logging destinations. See
signal
example.slog-term
is only one of many slog
features - useful showcase.
Automatic TTY detection and colors:
Compact vs full mode:
See examples/features.rs for full quick code example overview.
See [faq] for answers to common questions and [wiki] for other documentation articles. If you want to say hi, or need help use [slog-rs gitter] channel.
Read Documentation for details and features.
To report a bug or ask for features use github issues.
If you need to install Rust (come on, you should have done that long time ago!), use rustup.
In Cargo.toml:
[dependencies]
slog = "1.2"
In your main.rs
:
```
extern crate slog; ```