#logging #cli-tool #development

easy-logging

An easy way to get logging working in your CLI tool

4 releases

0.2.0 Jan 16, 2024
0.1.2 May 10, 2021
0.1.1 Aug 16, 2019
0.1.0 Sep 30, 2018

#251 in Debugging

Download history 20/week @ 2024-03-11 8/week @ 2024-03-18 48/week @ 2024-04-01 3/week @ 2024-04-08 3/week @ 2024-04-22 13/week @ 2024-04-29 14/week @ 2024-05-13 27/week @ 2024-05-20 15/week @ 2024-05-27 22/week @ 2024-06-03 33/week @ 2024-06-10 37/week @ 2024-06-17 49/week @ 2024-06-24

142 downloads per month
Used in 3 crates

Unlicense

9KB
145 lines

easy-logging

An easy way to get logging working in your command line tool. Suitable for simple CLI and prototyping.

Requires a single function call and provides colored logging to stdout/stderr out of the box.

Usage

Add to your Cargo.toml:

[dependencies]
easy-logging = "*"

Example:

extern crate easy_logging;
#[macro_use] extern crate log;

fn main() {
    easy_logging::init(module_path!(), log::Level::Info).unwrap();
    debug!("Test debug message.");
    info!("Test info message.");
}

Output with enabled info level:

I: Test info message.

Output with enabled debug level:

[22:29:18.084] [   main.rs:006] D: Test debug message.
[22:29:18.085] [   main.rs:007] I: Test info message.

Dependencies

~1.4–1.9MB
~24K SLoC