# log-wrap Utilities for log by wrapping `Box`, such as log filtering, log capturing ## Example filter log by module name ```rust fn main() { std::env::set_var("RUST_LOG", "info"); let logger = env_logger::Builder::from_default_env().build(); log::set_max_level(logger.filter()); log_wrap::LogWrap::new(Box::new(logger)) .black_module(["hyper", "h2"]) .init() .unwrap(); // your code ... } ``` capturing logs in each thread, and output them synchronously before thread exiting ```rust fn main() { std::env::set_var("RUST_LOG", "info"); let logger = env_logger::Builder::from_default_env().build(); log::set_max_level(logger.filter()); log_wrap::LogWrap::new(Box::new(logger)) .enable_thread_capture() .init() .unwrap(); let joins = (0..5) .map(|t| { std::thread::spawn(move || { let _guard = log_wrap::capture_thread_log(); for i in 0..5 { log::info!("thread#{t} {i} ..."); } }) }) .collect::>(); for j in joins { j.join().unwrap() } } ```