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 Jan 12, 2019

#4 in #macro-use

GPL-3.0-or-later

15KB
131 lines

license crates.io docs

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