talira

env_logger

Rust logger configured with the RUST_LOG environment variable

open sourceMIT OR Apache-2.0free

env_logger is a Rust crate that prints the messages a program logs through the log crate, with the levels and modules to show chosen at run time by the RUST_LOG environment variable (RUST_LOG=info, or RUST_LOG=my_app=debug for one module). It's meant for executables: libraries log through log and leave the choice of logger to the program. Tests can turn it on to see log output while they run.

Problems it solves

  • see log messages from my Rust program in the terminal
  • turn debug logging on for one module of my Rust app without recompiling
  • print log output from the log crate while my Rust tests run

Features

  • show a Rust program's log messages, filtered by the RUST_LOG environment variable
  • per-module log levels
  • log output in tests

Alternatives

The same job

These do what env_logger does.

  1. simple_logger A Rust logger that prints every message in a readable format
  2. tracing Application-level tracing and structured diagnostics for Rust

Compare env_logger with the top 3