#[repr(usize)]pub enum Level {
Error = 1,
Warn = 2,
Info = 3,
Debug = 4,
Trace = 5,
}Expand description
An enum representing the available verbosity levels of the logger.
Typical usage includes: checking if a certain Level is enabled with
log_enabled!, specifying the Level of
log!, and comparing a Level directly to a
LevelFilter.
Variants§
Error = 1
The “error” level.
Designates very serious errors.
Warn = 2
The “warn” level.
Designates hazardous situations.
Info = 3
The “info” level.
Designates useful information.
Debug = 4
The “debug” level.
Designates lower priority information.
Trace = 5
The “trace” level.
Designates very low priority, often extremely verbose, information.
Implementations§
Source§impl Level
impl Level
Sourcepub fn to_level_filter(&self) -> LevelFilter
pub fn to_level_filter(&self) -> LevelFilter
Converts the Level to the equivalent LevelFilter.
Sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
Returns the string representation of the Level.
This returns the same string as the fmt::Display implementation.
Sourcepub fn iter() -> impl Iterator<Item = Self>
pub fn iter() -> impl Iterator<Item = Self>
Iterate through all supported logging levels.
The order of iteration is from more severe to less severe log messages.
§Examples
use log::Level;
let mut levels = Level::iter();
assert_eq!(Some(Level::Error), levels.next());
assert_eq!(Some(Level::Trace), levels.last());Sourcepub fn increment_severity(&self) -> Self
pub fn increment_severity(&self) -> Self
Get the next-highest Level from this one.
If the current Level is at the highest level, the returned Level will be the same as the
current one.
§Examples
use log::Level;
let level = Level::Info;
assert_eq!(Level::Debug, level.increment_severity());
assert_eq!(Level::Trace, level.increment_severity().increment_severity());
assert_eq!(Level::Trace, level.increment_severity().increment_severity().increment_severity()); // max levelSourcepub fn decrement_severity(&self) -> Self
pub fn decrement_severity(&self) -> Self
Get the next-lowest Level from this one.
If the current Level is at the lowest level, the returned Level will be the same as the
current one.
§Examples
use log::Level;
let level = Level::Info;
assert_eq!(Level::Warn, level.decrement_severity());
assert_eq!(Level::Error, level.decrement_severity().decrement_severity());
assert_eq!(Level::Error, level.decrement_severity().decrement_severity().decrement_severity()); // min level