logidize

Crates.iologidize
lib.rslogidize
version0.5.2
sourcesrc
created_at2023-04-04 16:35:30.585101
updated_at2023-04-04 18:38:48.753022
descriptionA lightweight and performant logging utility
homepage
repositoryhttps://github.com/GereonV/logidize
max_upload_size
id830323
size41,543
Gereon (GereonV)

documentation

https://docs.rs/logidize

README

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");
}
Commit count: 54

cargo fmt