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.
Add to your Cargo.toml
:
[dependencies]
easy-logging = "*"
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.");
}
I: Test info message.
[22:29:18.084] [ main.rs:006] D: Test debug message.
[22:29:18.085] [ main.rs:007] I: Test info message.