don't store redundant has_meaningfull_message

This commit is contained in:
Robin Appelman 2024-07-22 22:29:07 +02:00
commit 3af655c17c
4 changed files with 4 additions and 4 deletions

View file

@ -34,7 +34,6 @@ pub struct LoggingStatement {
pub path: &'static str, pub path: &'static str,
pub line: usize, pub line: usize,
pub placeholders: &'static [&'static str], pub placeholders: &'static [&'static str],
pub has_meaningful_message: bool,
pub exception: Option<&'static str>, pub exception: Option<&'static str>,
pub regex: &'static str, pub regex: &'static str,
} }

View file

@ -40,7 +40,6 @@ pub struct LoggingStatement<'a> {
pub path: &'a str, pub path: &'a str,
pub line: usize, pub line: usize,
pub placeholders: &'a [&'a str], pub placeholders: &'a [&'a str],
pub has_meaningful_message: bool,
pub exception: Option<&'a str>, pub exception: Option<&'a str>,
pub regex: &'a str, pub regex: &'a str,
} }
@ -76,7 +75,6 @@ pub fn bake_statement(output: &mut String, statement: &crate::LoggingStatement)
level: statement.level.into(), level: statement.level.into(),
path: statement.path, path: statement.path,
line: statement.line, line: statement.line,
has_meaningful_message: statement.has_meaningful_message,
exception: statement.exception.as_deref(), exception: statement.exception.as_deref(),
placeholders: &placeholders, placeholders: &placeholders,
regex: &pattern, regex: &pattern,

View file

@ -27,6 +27,7 @@ pub struct LoggingStatement<'a> {
} }
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum MessagePart { pub enum MessagePart {
Literal(String), Literal(String),
PlaceHolder(String), PlaceHolder(String),

View file

@ -15,7 +15,9 @@ impl LogMatch {
level: statement.level, level: statement.level,
pattern: Regex::new(statement.regex).unwrap(), pattern: Regex::new(statement.regex).unwrap(),
pattern_length: statement.regex.len(), pattern_length: statement.regex.len(),
has_meaningful_message: statement.has_meaningful_message, has_meaningful_message: statement
.regex
.contains(|c: char| c.is_ascii_alphanumeric()),
exception: statement.exception, exception: statement.exception,
} }
} }