TermProcessor

Struct TermProcessor 

Source
pub struct TermProcessor { /* private fields */ }
Expand description

终端日志处理器 - 实现LogProcessor trait

Implementations§

Source§

impl TermProcessor

Source

pub fn new() -> Self

创建新的终端处理器

Source

pub fn with_config(config: TermConfig) -> Self

使用配置创建终端处理器

Source

pub fn with_formatter<F>(self, formatter: F) -> Self
where F: Fn(&mut dyn Write, &Record) -> Result<()> + Send + Sync + 'static,

设置自定义格式化函数

Source

pub fn with_format(self, format_config: FormatConfig) -> Self

使用格式配置

Source

pub fn with_format_and_color( self, format_config: FormatConfig, color_config: ColorConfig, ) -> Self

使用格式配置和颜色配置

Trait Implementations§

Source§

impl Drop for TermProcessor

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl LogProcessor for TermProcessor

Source§

fn name(&self) -> &'static str

处理器名称
Source§

fn process(&mut self, data: &[u8]) -> Result<(), String>

处理单个日志数据
Source§

fn process_batch(&mut self, batch: &[Vec<u8>]) -> Result<(), String>

批量处理日志数据 - 保持原有优化逻辑
Source§

fn flush(&mut self) -> Result<(), String>

刷新操作
Source§

fn cleanup(&mut self) -> Result<(), String>

清理资源
Source§

fn handle_rotate(&mut self) -> Result<(), String>

处理文件轮转命令 - 默认忽略(只有文件处理器需要处理)
Source§

fn handle_compress(&mut self, _path: &Path) -> Result<(), String>

处理文件压缩命令 - 默认忽略(只有文件处理器需要处理)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.