pub enum Level {
Debug,
Info,
Warn,
Error,
}Expand description
A severity level for a diagnostic event.
If a crate::Event has a level associated with it, it can be pulled from its props:
match evt.props().pull::<emit::Level, _>(emit::well_known::KEY_LVL).unwrap_or_default() {
emit::Level::Debug => {
// The event is at the debug level
}
emit::Level::Info => {
// The event is at the info level
}
emit::Level::Warn => {
// The event is at the warn level
}
emit::Level::Error => {
// The event is at the error level
}
}The default level is Level::Info.
§Parsing
Level has a permissive parser that will match partial and incomplete contents, ignoring case. So long as the start of the text is a submatch of the full level, and any trailing unmatched characters are not ASCII control characters, the level will parse.
For example, the following will all be parsed as Level::Info:
infoINFOiinfinformationINFO1inf(13)
Note that any trailing data is lost when levels are parsed. That means, for example, that INFO3 and INFO4 will both parse to the same value, Level::Info, and will sort equivalently.
Variants§
Debug
The event is weakly informative.
This variant is equal to LVL_DEBUG.
Info
The event is informative.
This variant is equal to LVL_INFO.
Warn
The event is weakly erroneous.
This variant is equal to LVL_WARN.
Error
The event is erroneous.
This variant is equal to LVL_ERROR.
Implementations§
Trait Implementations§
impl Copy for Level
impl Eq for Level
Source§impl From<Level> for MinLevelFilter
impl From<Level> for MinLevelFilter
Source§impl<'v> FromValue<'v> for Level
impl<'v> FromValue<'v> for Level
Source§fn from_value(value: Value<'v>) -> Option<Self>
fn from_value(value: Value<'v>) -> Option<Self>
Source§impl Ord for Level
impl Ord for Level
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Level
impl PartialOrd for Level
impl StructuralPartialEq for Level
Source§impl Value for Level
Available on crate feature sval only.
impl Value for Level
sval only.Source§fn stream<'sval, S: Stream<'sval> + ?Sized>(
&'sval self,
stream: &mut S,
) -> Result
fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S, ) -> Result
Stream.