6 releases (2 stable)

1.1.0 Apr 15, 2025
1.0.0 Aug 2, 2024
0.2.0 Jan 16, 2024
0.1.2 May 10, 2021
0.1.0 Sep 30, 2018

#334 in Debugging

Download history 42/week @ 2025-02-11 16/week @ 2025-02-18 30/week @ 2025-02-25 15/week @ 2025-03-04 44/week @ 2025-03-11 27/week @ 2025-03-18 25/week @ 2025-03-25 54/week @ 2025-04-01 91/week @ 2025-04-08 182/week @ 2025-04-15 88/week @ 2025-04-22 78/week @ 2025-04-29 125/week @ 2025-05-06 73/week @ 2025-05-13 9/week @ 2025-05-20 6/week @ 2025-05-27

219 downloads per month
Used in 4 crates

Unlicense

11KB
203 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 = "1"

Example:

use log::{Level, debug, info};

fn main() {
    easy_logging::init(module_path!(), 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–2MB
~24K SLoC

OSZAR »