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); }