#logger #logging #log #single-threaded

yanked logidize

A lightweight and performant logging utility

2 releases

0.5.2 Apr 4, 2023
0.5.1 Apr 4, 2023

#43 in #single-threaded

MIT license

41KB
776 lines

Logidize

A lightweight and performant logging utility

Getting started

use logidize::{*, loggers::{Level, single_threaded::*}, sinks::WriteSink};

fn main() {
    let logger: SimpleLogger<WriteSink> = Default::default();
    debug!(logger, "{}", "Hello Debug!");
    info!(logger, "{}", "Hello Info!");
    warning!(logger, "{}", "Hello Warning!");
    error!(logger, "{}", "Hello Error!");
    critical!(logger, "{}", "Hello Critical!");
    log!(logger, Level::DEBUG, "{}", "Hello Dynamic!");
}

Using default logger

use logidize::*;

fn main() {
    default_logger!().sink().unwrap()
        .channel_map.set_channel_name_or_insert_channel(0, "Main-Channel");
    debug!("logged to global logger's main-channel");
}

Customizing default logger

use logidize::{*, loggers::single_threaded::*, sinks::WriteSink};

fn main() {
    let logger: SimpleLogger<WriteSink> = Default::default();
    macro_rules! default_logger { () => { logger }; }
    info!("you can change what logger the macros default to");
}

Dependencies

~530KB