Skip to main content

ConfigBuilder

Struct ConfigBuilder 

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

配置构建器

Implementations§

Source§

impl ConfigBuilder

Source

pub fn new() -> Self

创建新的配置构建器

Source

pub fn level<S: Into<String>>(self, level: S) -> Self

设置日志级别

Source

pub fn file<P: AsRef<Path>>(self, path: P) -> Self

设置输出文件

Source

pub fn console(self, enabled: bool) -> Self

启用/禁用控制台输出

Source

pub fn verbose(self, enabled: bool) -> Self

启用/禁用详细模式

Source

pub fn time_format<S: Into<String>>(self, format: S) -> Self

设置时间格式

Source

pub fn rotation(self, max_size: u64, max_files: u32, compress: bool) -> Self

启用文件轮转

Source

pub fn highlight_keywords(self, keywords: Vec<String>) -> Self

添加关键词高亮

Source

pub fn add_filter(self, filter_type: FilterType, rule: String) -> Self

添加过滤器

Source

pub fn custom_field<K: Into<String>, V: Into<String>>( self, key: K, value: V, ) -> Self

添加自定义字段

Source

pub fn build(self) -> LogConfig

构建配置

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.