Checking logging is enabled

Sometimes, logging may require a lot of resources. In this case, you can use the log_enabled! macro to check that a certain logging level has been enabled:

if log_enabled!(Debug) {
    let data = get_data_which_requires_resources();
    debug!("expensive data: {}", data);
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.8.8