postfix_log_parser/formatters/
mod.rs

1pub mod json;
2
3use crate::parsing::ParseResult;
4use std::error::Error;
5
6/// 格式化器trait,用于将解析结果转换为不同格式
7pub trait LogFormatter {
8    /// 格式化单个解析结果
9    fn format_single(
10        &self,
11        line_number: usize,
12        line: &str,
13        result: &ParseResult,
14    ) -> Result<String, Box<dyn Error>>;
15
16    /// 格式化多个解析结果
17    fn format_multiple(
18        &self,
19        results: Vec<(usize, String, ParseResult)>,
20    ) -> Result<String, Box<dyn Error>>;
21}