Struct fast_log::config::Config

source ·
pub struct Config {
    pub appends: SyncVec<Mutex<Box<dyn LogAppender>>>,
    pub level: LevelFilter,
    pub filters: SyncVec<Box<dyn Filter>>,
    pub format: Box<dyn RecordFormat>,
    pub chan_len: Option<usize>,
}
Expand description

the fast_log Config for example:

use fast_log::Config;
fn main(){
   fast_log::init(Config::new().console().chan_len(Some(1000000))).unwrap();
}

Fields§

§appends: SyncVec<Mutex<Box<dyn LogAppender>>>

Each appender is responsible for printing its own business every LogAppender have one thread(need Mutex) access this.

§level: LevelFilter

the log level filter

§filters: SyncVec<Box<dyn Filter>>

filter log

§format: Box<dyn RecordFormat>

format record into field fast_log_record’s formatted:String

§chan_len: Option<usize>

the channel length,default None(Unbounded channel)

Implementations§

source§

impl Config

source

pub fn new() -> Self

source

pub fn level(self, level: LevelFilter) -> Self

set log LevelFilter

source

pub fn add_filter<F: Filter + 'static>(self, filter: F) -> Self

add log Filter

source

pub fn filter(self, filters: Vec<Box<dyn Filter>>) -> Self

add log Filter

source

pub fn format<F: RecordFormat + 'static>(self, format: F) -> Self

set log format

source

pub fn console(self) -> Self

add a ConsoleAppender

source

pub fn file(self, file: &str) -> Self

add a FileAppender

source

pub fn file_loop(self, file: &str, max_temp_size: LogSize) -> Self

add a FileLoopAppender

source

pub fn file_split<P: Packer + Sync + 'static, R: Keep + 'static>( self, file_path: &str, temp_size: LogSize, rolling_type: R, packer: P ) -> Self

add a FileSplitAppender

source

pub fn split<F: SplitFile + 'static, R: Keep + 'static, P: Packer + Sync + 'static>( self, file_path: &str, temp_size: LogSize, keeper: R, packer: P ) -> Self

add a SplitAppender .split::<FileType, Packer>() for example:

source

pub fn custom<Appender: LogAppender + 'static>(self, arg: Appender) -> Self

add a custom LogAppender

source

pub fn add_appender<Appender: LogAppender + 'static>( self, arg: Appender ) -> Self

add a LogAppender

source

pub fn chan_len(self, len: Option<usize>) -> Self

if none=> unbounded() channel,if Some => bounded(len) channel

Trait Implementations§

source§

impl Debug for Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Config

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl !UnwindSafe for Config

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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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>,

§

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.