Crates.io | youlog |
lib.rs | youlog |
version | 0.1.2 |
source | src |
created_at | 2023-08-30 06:31:52.595187 |
updated_at | 2023-10-10 22:49:21.696123 |
description | A logging crate where you bring your own logging logic |
homepage | |
repository | https://github.com/sometimes-youwin/youlog.git |
max_upload_size | |
id | 958744 |
size | 33,975 |
A thin logging implementation for Rust's log facade.
This crate allows for providing custom functions to the logger.
Examples where this might be useful:
RUST_LOG
by default)use log::LevelFilter;
use youlog::Youlog;
Youlog::new()
.global_level(LevelFilter::Info)
.log_fn(LevelFilter::Info, |record| {
println!("info {}", record.args().as_str().unwrap_or_default());
})
.raw_fn(|record| {
println!("raw {}", record.args().as_str().unwrap_or_default());
})
.level("some_module", LevelFilter::Error)
.init()
.expect("unable to init logger");
log::info!("this is an info log!");
MPL-2.0
Filter implementation referenced from env_logger
.