slog-envlogger

Crates.ioslog-envlogger
lib.rsslog-envlogger
version2.2.0
sourcesrc
created_at2016-08-17 21:52:56.50141
updated_at2019-08-22 05:16:46.075498
descriptionPort of de facto standard logger implementation for Rust, to `slog-rs` framework.
homepagehttps://github.com/slog-rs/slog
repositoryhttps://github.com/slog-rs/envlogger
max_upload_size
id6008
size42,333
Dawid Ciężarkiewicz (dpc)

documentation

https://docs.rs/slog-envlogger

README

slog-rs logo
Travis CI Build Status crates.io slog-rs Gitter Chat
Documentation

slog-envlogger - Port of env_logger as a slog-rs drain

env_logger is a de facto standard Rust logger implementation, which allows controlling logging to stderr via the RUST_LOG environment variable.

This is a fork of env_logger that makes it work as a slog-rs drain.

Notable changes:

  • Support for slog-stdlog to provide support for legacy info!(...) like statements.
  • envlogger does not do any formatting anymore: slog-envlogger can be composed with any other slog-rs drains, so there's no point for it to provide it's own formatting. You can now output to a file, use JSON, have color output or any other future that slog ecosystem provides, controlling it via RUST_LOG environment var.

Status & news

Warning: Documentation has been been left mostly untouched, which means some places of it might be confusing.

How to use

See examples directory.

The simplest way to convert existing project to use slog-rs+slog-envlogger is shown in simple example

For more proper (and powerful) version see proper example

Using slog-stdlog scopes you can make parts of the code log additional information (see scopes example):

Commit count: 193

cargo fmt