pub struct MasterParser { /* private fields */ }
Expand description
主解析器
对应Postfix的master进程,负责识别组件并分发到相应的解析器
Implementations§
Source§impl MasterParser
impl MasterParser
Sourcepub fn register_parser(
&mut self,
component: &str,
parser: Box<dyn ComponentParser>,
)
pub fn register_parser( &mut self, component: &str, parser: Box<dyn ComponentParser>, )
注册组件解析器
允许用户注册自定义组件解析器
Sourcepub fn parse(&self, log_line: &str) -> ParseResult
pub fn parse(&self, log_line: &str) -> ParseResult
解析单行日志
这是主要的解析入口点
Sourcepub fn registered_components(&self) -> Vec<&String>
pub fn registered_components(&self) -> Vec<&String>
获取已注册的组件列表
Sourcepub fn parse_base_info(&self, log_line: &str) -> Result<BaseLogInfo, ParseError>
pub fn parse_base_info(&self, log_line: &str) -> Result<BaseLogInfo, ParseError>
公共方法:解析基础日志格式(用于测试)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MasterParser
impl !RefUnwindSafe for MasterParser
impl Send for MasterParser
impl Sync for MasterParser
impl Unpin for MasterParser
impl !UnwindSafe for MasterParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more