Crate slog_scope_stdlog

Source
Expand description

Standard Rust log crate adapter to slog-rs based on slog-scope.

Note: this is a fork of a slog-stdlog that unlike original does share logging scopes with slog-scope crate. It is currently advised to prefer slog-scope-stdlog.

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 -> …

Structs§

StdLog
Drain logging Records into log crate

Functions§

init
Minimal initialization with default drain