#[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 · Source§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
Source§impl Hash for LevelFilter
impl Hash for LevelFilter
Source§impl Ord for LevelFilter
impl Ord for LevelFilter
Source§fn cmp(&self, other: &LevelFilter) -> Ordering
fn cmp(&self, other: &LevelFilter) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes
Size for each variant:
Off
: 0 bytesError
: 0 bytesWarn
: 0 bytesInfo
: 0 bytesDebug
: 0 bytesTrace
: 0 bytes