Crate slog_stdlog [] [src]

Standard Rust log crate adapter to slog-rs

Note: slog-stdlog for slog v2, unlike previous releases uses logging scopes provided by slog-scope crate instead of providing it's own ones.

This crate provides two way compatibility with legacy log crate logging.

log -> slog

After calling init legacy log crate logging statements (eg. debug!(...)) will be redirected just like they originated from the logger returned by slog_scope::logger(). See documentation of slog-scope for examples of logging scope usage.

slog -> log

StdLog is a slog::Drain implementation that will log logging Records just like they were created using legacy log statements.

Warning

Be careful when using both methods at the same time, as a loop can be easily created: log -> slog -> log -> ...

Compile-time log level filtering

For filtering debug! and other log statements at compile-time, configure the features on the log crate in your Cargo.toml:

log = { version = "*", features = ["max_level_trace", "release_max_level_warn"] }

Structs

StdLog

Drain logging Records into log crate

Functions

init

Minimal initialization with default drain