#[repr(usize)]
pub enum Level {
Error,
Warn,
Info,
Debug,
Trace,
}
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
The “error” level.
Designates very serious errors.
Warn
The “warn” level.
Designates hazardous situations.
Info
The “info” level.
Designates useful information.
Debug
The “debug” level.
Designates lower priority information.
Trace
The “trace” level.
Designates very low priority, often extremely verbose, information.
Implementations
sourceimpl 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());
Trait Implementations
sourceimpl Ord for Level
impl Ord for Level
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialEq<LevelFilter> for Level
impl PartialEq<LevelFilter> for Level
sourcefn eq(&self, other: &LevelFilter) -> bool
fn eq(&self, other: &LevelFilter) -> bool
sourceimpl PartialOrd<Level> for Level
impl PartialOrd<Level> for Level
sourceimpl PartialOrd<Level> for LevelFilter
impl PartialOrd<Level> for LevelFilter
sourceimpl PartialOrd<LevelFilter> for Level
impl PartialOrd<LevelFilter> for Level
sourcefn partial_cmp(&self, other: &LevelFilter) -> Option<Ordering>
fn partial_cmp(&self, other: &LevelFilter) -> Option<Ordering>
sourcefn lt(&self, other: &LevelFilter) -> bool
fn lt(&self, other: &LevelFilter) -> bool
sourcefn le(&self, other: &LevelFilter) -> bool
fn le(&self, other: &LevelFilter) -> bool
self
and other
) and is used by the <=
operator. Read moresourcefn gt(&self, other: &LevelFilter) -> bool
fn gt(&self, other: &LevelFilter) -> bool
sourcefn ge(&self, other: &LevelFilter) -> bool
fn ge(&self, other: &LevelFilter) -> bool
self
and other
) and is used by the >=
operator. Read more