mirror of
https://gitee.com/openharmony/third_party_rust_log
synced 2025-02-19 23:11:49 +00:00
commit
2d3ecdfe86
14
src/lib.rs
14
src/lib.rs
@ -560,6 +560,13 @@ impl Level {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
LOG_LEVEL_NAMES[*self as usize]
|
||||
}
|
||||
|
||||
/// Iterate through all supported logging levels
|
||||
///
|
||||
/// The order of iteration is from more severe to less severe log messages
|
||||
pub fn iter() -> impl Iterator<Item = Self> {
|
||||
(1..).flat_map(Self::from_usize)
|
||||
}
|
||||
}
|
||||
|
||||
/// An enum representing the available verbosity level filters of the logger.
|
||||
@ -722,6 +729,13 @@ impl LevelFilter {
|
||||
pub fn as_str(&self) -> &'static str {
|
||||
LOG_LEVEL_NAMES[*self as usize]
|
||||
}
|
||||
|
||||
/// Iterate through all supported filtering levels
|
||||
///
|
||||
/// The order of iteration is from less to more verbose filtering
|
||||
pub fn iter() -> impl Iterator<Item = Self> {
|
||||
(0..).flat_map(Self::from_usize)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user