pub fn set_minimum_priority(prio: Priority) -> Result<()>Expand description
Blocks low priority logs.
Allows filtering low priority logs globally, think a runtime “–verbose” mode, except you can choose which priorities to filter. Using this (as opposed to filtering later, when retrieving logs) is that it helps conserve system logging resources (buffer space etc.).
§Arguments
prio- Minimum priority level.
§Examples
use dlog::Priority;
use log::{error, info, warn};
fn main() -> Result<(), std::io::Error> {
dlog::init(false)?;
info!("no filter so this log goes through");
dlog::set_minimum_priority(Priority::Warn)?;
info!("WARN is a higher level than INFO so this log gets filtered");
warn!("but this one still goes through");
error!("as does this one");
Ok(())
}