Enum log::LevelFilter
source · [−]#[repr(usize)]
pub enum LevelFilter {
Off,
Error,
Warn,
Info,
Debug,
Trace,
}
Expand description
An enum representing the available verbosity level filters of the logger.
A LevelFilter
may be compared directly to a Level
. Use this type
to get and set the maximum log level with max_level()
and set_max_level
.
Variants
Off
A level lower than all log levels.
Error
Corresponds to the Error
log level.
Warn
Corresponds to the Warn
log level.
Info
Corresponds to the Info
log level.
Debug
Corresponds to the Debug
log level.
Trace
Corresponds to the Trace
log level.
Implementations
sourceimpl LevelFilter
impl LevelFilter
sourcepub fn max() -> LevelFilter
pub fn max() -> LevelFilter
Returns the most verbose logging level filter.
sourcepub fn to_level(&self) -> Option<Level>
pub fn to_level(&self) -> Option<Level>
Converts self
to the equivalent Level
.
Returns None
if self
is LevelFilter::Off
.
sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
Returns the string representation of the LevelFilter
.
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 filtering levels.
The order of iteration is from less to more verbose filtering.
Examples
use log::LevelFilter;
let mut levels = LevelFilter::iter();
assert_eq!(Some(LevelFilter::Off), levels.next());
assert_eq!(Some(LevelFilter::Trace), levels.last());
Trait Implementations
sourceimpl Clone for LevelFilter
impl Clone for LevelFilter
sourcefn clone(&self) -> LevelFilter
fn clone(&self) -> LevelFilter
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for LevelFilter
impl Debug for LevelFilter
sourceimpl Display for LevelFilter
impl Display for LevelFilter
sourceimpl FromStr for LevelFilter
impl FromStr for LevelFilter
type Err = ParseLevelError
type Err = ParseLevelError
sourceimpl Hash for LevelFilter
impl Hash for LevelFilter
sourceimpl Ord for LevelFilter
impl Ord for LevelFilter
sourcefn cmp(&self, other: &LevelFilter) -> Ordering
fn cmp(&self, other: &LevelFilter) -> Ordering
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 PartialEq<LevelFilter> for LevelFilter
impl PartialEq<LevelFilter> for LevelFilter
sourcefn eq(&self, other: &LevelFilter) -> bool
fn eq(&self, other: &LevelFilter) -> bool
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 moresourceimpl PartialOrd<LevelFilter> for LevelFilter
impl PartialOrd<LevelFilter> for LevelFilter
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