#[repr(u16)]
pub enum Level {
Critical,
Error,
Warn,
Info,
Debug,
Trace,
}
Expand description
An enum representing log levels.
Typical usage includes: specifying the Level
of log!
, and comparing a
Level
to a LevelFilter
through LevelFilter::compare
.
Warnings
Users should never convert variants of this enum to integers for persistent
storage (e.g., configuration files), using Level::as_str
instead,
because integers corresponding to variants may change in the future.
Do not do this:
let level: usize = Level::Info as usize;
save_config(level);
Instead:
let level: &'static str = Level::Info.as_str();
save_config(level);
Examples
use spdlog::prelude::*;
log!(Level::Info, "hello, world");
Variants
Critical
Designates critical errors.
Error
Designates very serious errors.
Warn
Designates hazardous situations.
Info
Designates useful information.
Debug
Designates lower priority information.
Trace
Designates very low priority, often extremely verbose, information.
Implementations
sourceimpl Level
impl Level
sourcepub const fn most_severe() -> Level
pub const fn most_severe() -> Level
Returns the most severe logging level.
sourcepub const fn most_verbose() -> Level
pub const fn most_verbose() -> Level
Returns the most verbose logging level.
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 more verbose.
Examples
use spdlog::Level;
let mut levels = Level::iter();
assert_eq!(Some(Level::Critical), levels.next());
assert_eq!(Some(Level::Trace), levels.last());
Trait Implementations
impl Copy for Level
impl Eq for Level
impl StructuralEq for Level
impl StructuralPartialEq for Level
Auto Trait Implementations
impl RefUnwindSafe for Level
impl Send for Level
impl Sync for Level
impl Unpin for Level
impl UnwindSafe for Level
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more