Parse a log into entries, folding continuation lines into their entry. The plugin writer appends `message` unescaped, so a stack trace or a multi-paragraph error spans several physical lines. A line that does not start with a timestamp is therefore a continuation of the entry above it, not a separate entry — and dropping it would lose most of the message. Returns the entries plus the number of p
(body: &str)
| 425 | /// Returns the entries plus the number of physical lines consumed, so the |
| 426 | /// report can be honest about what fraction of the file it understood. |
| 427 | fn parse_error_log(body: &str) -> (Vec<HookErrorEntry>, usize) { |
| 428 | let mut entries: Vec<HookErrorEntry> = Vec::new(); |
| 429 | let mut lines = 0usize; |
| 430 | |
| 431 | for line in body.lines() { |
| 432 | if line.trim().is_empty() { |
| 433 | continue; |
| 434 | } |
| 435 | lines += 1; |
| 436 | |
| 437 | match parse_error_line(line) { |
| 438 | Some(entry) => entries.push(entry), |
| 439 | None => { |
| 440 | if let Some(last) = entries.last_mut() { |
| 441 | last.message = truncate_detail(&format!("{} {}", last.message, line.trim())); |
| 442 | } |
| 443 | } |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | (entries, lines) |
| 448 | } |
| 449 | |
| 450 | /// Parse one log line into an entry, or `None` if it is not shaped like one. |
| 451 | /// |