5 unstable releases
0.3.1 | Apr 4, 2019 |
---|---|
0.3.0 | Mar 22, 2019 |
0.2.1 | Jan 27, 2019 |
0.1.0 | Jan 14, 2019 |
0.0.1 |
|
#4 in #macro-use
15KB
131 lines
mlog
A logging implementation in Rust.
#[macro_use]
extern crate log;
extern crate chrono;
extern crate mlog;
use mlog::Logger;
fn main() {
Logger::new()
.for_module("mlog_example::*", log::LevelFilter::Off)
.format(|record| {
format!(
"[{}] {}: {}",
chrono::Local::now()
.format("%H:%M:%S"),
record.level(),
record.args()
)
})
.set_default_level(log::LevelFilter::Info)
.ready()
.unwrap();
info!("hello, world!");
}
lib.rs
:
A logging implementation in Rust.
Example
#[macro_use]
extern crate log;
extern crate chrono;
extern crate mlog;
use mlog::Logger;
fn main() {
Logger::new()
.for_module("mlog_example::*", log::LevelFilter::Off)
.format(|record| {
format!(
"[{}] {}: {}",
chrono::Local::now()
.format("%H:%M:%S"),
record.level(),
record.args()
)
})
.set_default_level(log::LevelFilter::Info)
.ready()
.unwrap();
info!("hello, world!");
}
Dependencies
~1MB
~14K SLoC