Enum log::LevelFilter
source · #[repr(usize)]pub enum LevelFilter {
Off = 0,
Error = 1,
Warn = 2,
Info = 3,
Debug = 4,
Trace = 5,
}
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 = 0
A level lower than all log levels.
Error = 1
Corresponds to the Error
log level.
Warn = 2
Corresponds to the Warn
log level.
Info = 3
Corresponds to the Info
log level.
Debug = 4
Corresponds to the Debug
log level.
Trace = 5
Corresponds to the Trace
log level.
Implementations§
source§impl 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§
source§impl Clone for LevelFilter
impl Clone for LevelFilter
source§fn clone(&self) -> LevelFilter
fn clone(&self) -> LevelFilter
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for LevelFilter
impl Debug for LevelFilter
source§impl Display for LevelFilter
impl Display for LevelFilter
source§impl FromStr for LevelFilter
impl FromStr for LevelFilter
§type Err = ParseLevelError
type Err = ParseLevelError
source§fn from_str(level: &str) -> Result<LevelFilter, Self::Err>
fn from_str(level: &str) -> Result<LevelFilter, Self::Err>
s
to return a value of this type. Read moresource§impl Hash for LevelFilter
impl Hash for LevelFilter
source§impl Ord for LevelFilter
impl Ord for LevelFilter
source§impl PartialEq<Level> for LevelFilter
impl PartialEq<Level> for LevelFilter
source§impl PartialEq<LevelFilter> for Level
impl PartialEq<LevelFilter> for Level
source§impl PartialEq for LevelFilter
impl PartialEq for LevelFilter
source§impl PartialOrd<Level> for LevelFilter
impl PartialOrd<Level> for LevelFilter
source§impl PartialOrd<LevelFilter> for Level
impl PartialOrd<LevelFilter> for Level
source§impl PartialOrd for LevelFilter
impl PartialOrd for LevelFilter
impl Copy for LevelFilter
impl Eq for LevelFilter
impl StructuralPartialEq for LevelFilter
Auto Trait Implementations§
impl Freeze for LevelFilter
impl RefUnwindSafe for LevelFilter
impl Send for LevelFilter
impl Sync for LevelFilter
impl Unpin for LevelFilter
impl UnwindSafe for LevelFilter
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)