mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 18:14:11 +02:00
exception matching
This commit is contained in:
parent
28c93c935c
commit
4bf687461f
7 changed files with 185 additions and 23 deletions
|
|
@ -1,6 +1,8 @@
|
|||
use serde::Deserialize;
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Clone, Copy)]
|
||||
#[derive(Debug, Default, PartialEq, Clone, Copy, Deserialize)]
|
||||
#[serde(from = "i64")]
|
||||
pub enum LogLevel {
|
||||
Debug,
|
||||
Info,
|
||||
|
|
@ -28,6 +30,12 @@ impl From<i64> for LogLevel {
|
|||
}
|
||||
}
|
||||
|
||||
impl LogLevel {
|
||||
pub fn matches(&self, matcher_level: LogLevel) -> bool {
|
||||
matcher_level == *self || matcher_level == LogLevel::Exception || *self == LogLevel::Unknown
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub struct LoggingStatement {
|
||||
pub level: LogLevel,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue