#logging-framework #env-logger #slog-rs #drain #env-var #standard #de

slog-envlogger

Port of de facto standard logger implementation for Rust, to slog-rs framework

13 releases (3 stable)

Uses old Rust 2015

2.2.0 Aug 22, 2019
2.1.0 Dec 15, 2017
2.0.0 Apr 30, 2017
2.0.0-1.0 Mar 6, 2017
0.5.0 Sep 21, 2016

#199 in Debugging

Download history 24825/week @ 2023-11-27 22517/week @ 2023-12-04 23906/week @ 2023-12-11 16347/week @ 2023-12-18 5624/week @ 2023-12-25 15477/week @ 2024-01-01 19516/week @ 2024-01-08 16429/week @ 2024-01-15 18885/week @ 2024-01-22 19943/week @ 2024-01-29 19425/week @ 2024-02-05 21510/week @ 2024-02-12 19908/week @ 2024-02-19 21962/week @ 2024-02-26 20995/week @ 2024-03-04 8271/week @ 2024-03-11

71,656 downloads per month
Used in 56 crates (28 directly)

MIT/Apache

25KB
416 lines

slog-rs logo
Travis CI Build Status 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):

Dependencies

~4–14MB
~140K SLoC