mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 10:04:12 +02:00
handle multiple "equal" matches
This commit is contained in:
parent
2ba2b82a4a
commit
09f6ac6f47
3 changed files with 80 additions and 27 deletions
|
|
@ -46,6 +46,23 @@ pub struct LoggingStatement {
|
|||
pub regex: &'static str,
|
||||
}
|
||||
|
||||
impl Display for LoggingStatement {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
if let Some(exception) = self.exception {
|
||||
write!(
|
||||
f,
|
||||
"{}({}): {} line {}",
|
||||
exception,
|
||||
self.message(),
|
||||
self.path,
|
||||
self.line
|
||||
)
|
||||
} else {
|
||||
write!(f, "{}: {} line {}", self.message(), self.path, self.line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl LoggingStatement {
|
||||
pub fn message(&self) -> impl Display + '_ {
|
||||
LoggingMessage { message: &self }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue