Crate slog_stdlog [] [src]

log crate adapter for slog-rs

This crate provides two way compatibility with legacy (ha! or shall we say... standard) log crate logging.

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

log -> slog

After calling init() slog-stdlog will take a role of log crate backend, forwarding all the log logging to slog_scope::logger(). In other words, any log crate logging statement will behave like it was slog logging statement executed with logger returned by slog_scope::logger(). See documentation of slog-scope for more information about logging scopes.

slog -> log

StdLog is slog::Drain that will pass all Records passing through it to log crate just like they were crated with log crate logging macros in the first place.

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

Register slog-stdlog as log backend.