#logging #log-level #stderr #log

stderrlog

Logger that logs to stderr based on verbosity specified

17 releases

0.6.0 Jan 31, 2024
0.5.4 Nov 4, 2022
0.5.3 Jul 3, 2022
0.5.1 Jan 10, 2021
0.2.1 Jun 6, 2016

#32 in Debugging

Download history 12614/week @ 2024-07-22 13142/week @ 2024-07-29 13269/week @ 2024-08-05 14738/week @ 2024-08-12 12444/week @ 2024-08-19 14358/week @ 2024-08-26 12622/week @ 2024-09-02 14914/week @ 2024-09-09 14915/week @ 2024-09-16 15431/week @ 2024-09-23 18494/week @ 2024-09-30 16977/week @ 2024-10-07 17186/week @ 2024-10-14 19088/week @ 2024-10-21 18943/week @ 2024-10-28 17179/week @ 2024-11-04

73,304 downloads per month
Used in 174 crates (154 directly)

MIT/Apache

28KB
361 lines

Build status Build status Average time to resolve an issue Percentage of issues still open Rust version Documentation Latest version All downloads Downloads of latest version

Logger that aims to provide a simple case of env_logger that just logs to stderr based on verbosity.

Documentation

For a working example for StructOpt, clap, and docopt please see the crate level documentation.

For example binaries showing how module level logging works, please see the large-example crate in examples/.

Supported Versions

  • stderrlog 0.6.x supports
    1. Rust 1.48.0 and newer
    2. log >= 0.4.11
  • stderrlog 0.5.x supports
    1. Rust 1.36.0 and newer
    2. log >= 0.4.11
  • stderrlog 0.4.x supports
    1. Rust 1.16.0 and newer
    2. log >= 0.4.1
  • stderrlog 0.3.x supports
    1. Rust 1.16.0 and newer
    2. log 0.3.x
  • stderrlog 0.2.x supports
    1. Rust 1.13.0 and newer
    2. log >= 0.3.0, < 0.3.9

Usage

Add this to your Cargo.toml:

[dependencies]
stderrlog = "0.4"

and this to your main():

stderrlog::new().verbosity(args.flag_v).quiet(args.flag_q).init().unwrap();

where your args struct is defined as:

struct Args {
    flag_v: usize,
    flag_q: bool,
    ...
}

Dependencies

~0.2–7.5MB
~51K SLoC