get_handler!() { /* proc-macro */ }Expand description
Get the required Handler.
ยงExamples
extern crate flogging;
use flogging::*;
// Setting up the module level logger.
const_logger!({
Logger::builder(module_path!())
.add_string_handler()
.set_level(Level::ALL)
.build()
});
#[logger]
fn my_func(){
info!("Some text to store.");
warning!("Rain is wet!");
severe!("Hurricanes are windy!");
if let Some(h) = get_handler!(Handler::String) {
println!(
"\n(h.get_log())\n======v======\n{}\n======^======",
h.get_log()
);
} else {
println!("Sorry. Not there!");
}
}Output:
(h.get_log())
======v======
|flogging->my_func| [INFO ] Some text to store.
|flogging->my_func| [WARNING] Rain is wet!
|flogging->my_func| [SEVERE ] Hurricanes are windy!
======^======