mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 18:14:11 +02:00
require at least 3 characters in pattern for matching
This commit is contained in:
parent
e2a09c71f5
commit
1a667a68cc
7 changed files with 8839 additions and 8827 deletions
|
|
@ -38,6 +38,7 @@ pub struct LoggingStatement<'a> {
|
|||
pub placeholders: &'a [&'a str],
|
||||
pub exception: Option<&'a str>,
|
||||
pub pattern: &'a str,
|
||||
pub has_meaningful_message: bool,
|
||||
}
|
||||
|
||||
fn build_pattern(parts: &[crate::MessagePart]) -> String {
|
||||
|
|
@ -71,6 +72,11 @@ pub fn bake_statement(output: &mut String, statement: &crate::LoggingStatement)
|
|||
exception: statement.exception.as_deref(),
|
||||
placeholders: &placeholders,
|
||||
pattern: &pattern,
|
||||
has_meaningful_message: message_is_meaningful(&pattern),
|
||||
};
|
||||
output.push_str(&statement.bake(&Default::default()).to_string());
|
||||
}
|
||||
|
||||
fn message_is_meaningful(msg: &str) -> bool {
|
||||
msg.chars().filter(|c| c.is_alphanumeric()).count() > 3
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue