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
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl 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
The associated error which can be returned from parsing.
sourceimpl Hash for LevelFilter
impl Hash for LevelFilter
sourceimpl Ord for LevelFilter
impl Ord for LevelFilter
sourceimpl PartialEq<Level> for LevelFilter
impl PartialEq<Level> for LevelFilter
sourceimpl PartialEq<LevelFilter> for Level
impl PartialEq<LevelFilter> for Level
sourceimpl PartialEq<LevelFilter> for LevelFilter
impl PartialEq<LevelFilter> for LevelFilter
sourceimpl PartialOrd<Level> for LevelFilter
impl PartialOrd<Level> for LevelFilter
sourcefn partial_cmp(&self, other: &Level) -> Option<Ordering>
fn partial_cmp(&self, other: &Level) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, other: &Level) -> bool
fn lt(&self, other: &Level) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, other: &Level) -> bool
fn le(&self, other: &Level) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
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>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, other: &LevelFilter) -> bool
fn lt(&self, other: &LevelFilter) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, other: &LevelFilter) -> bool
fn le(&self, other: &LevelFilter) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourcefn gt(&self, other: &LevelFilter) -> bool
fn gt(&self, other: &LevelFilter) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
sourcefn ge(&self, other: &LevelFilter) -> bool
fn ge(&self, other: &LevelFilter) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
sourceimpl 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>
This method returns an ordering between self
and other
values if one exists. Read more
sourcefn lt(&self, other: &LevelFilter) -> bool
fn lt(&self, other: &LevelFilter) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
sourcefn le(&self, other: &LevelFilter) -> bool
fn le(&self, other: &LevelFilter) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourcefn gt(&self, other: &LevelFilter) -> bool
fn gt(&self, other: &LevelFilter) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
sourcefn ge(&self, other: &LevelFilter) -> bool
fn ge(&self, other: &LevelFilter) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Copy for LevelFilter
impl Eq for LevelFilter
impl StructuralEq for LevelFilter
Auto Trait Implementations
impl RefUnwindSafe for LevelFilter
impl Send for LevelFilter
impl Sync for LevelFilter
impl Unpin for LevelFilter
impl UnwindSafe for LevelFilter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more