#log #logging #slog #json-log #json

slog-scope-stdlog

Standard Rust log crate adapter to slog-rs

1 unstable release

Uses old Rust 2015

0.2.0 Jan 1, 2017

#21 in #json-log

MPL-2.0 license

170KB
3.5K SLoC

slog-scope-stdlog - Standard Rust log crate adapter for slog-rs - integrated with slog-scope

Travis CI Build Status slog-scope-stdlog on crates.io slog-rs Gitter Chat

This is a preferred (over original slog-stdlog) method of backward compatibility with legacy log crate.

The difference is: this library does not define own logging scopes functionality, and instead relies on slog_scope::scope.


lib.rs:

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

Dependencies

~3MB
~44K SLoC