[][src]Struct sloggers::file::FileLoggerBuilder

pub struct FileLoggerBuilder { /* fields omitted */ }

A logger builder which build loggers that write log records to the specified file.

The resulting logger will work asynchronously (the default channel size is 1024).

Methods

impl FileLoggerBuilder[src]

pub fn new<P: AsRef<Path>>(path: P) -> Self[src]

Makes a new FileLoggerBuilder instance.

This builder will create a logger which uses path as the output destination of the log records.

pub fn format(&mut self, format: Format) -> &mut Self[src]

Sets the format of log records.

pub fn source_location(&mut self, source_location: SourceLocation) -> &mut Self[src]

Sets the source code location type this logger will use.

pub fn overflow_strategy(
    &mut self,
    overflow_strategy: OverflowStrategy
) -> &mut Self
[src]

Sets the overflow strategy for the logger.

pub fn timezone(&mut self, timezone: TimeZone) -> &mut Self[src]

Sets the time zone which this logger will use.

pub fn level(&mut self, severity: Severity) -> &mut Self[src]

Sets the log level of this logger.

pub fn channel_size(&mut self, channel_size: usize) -> &mut Self[src]

Sets the size of the asynchronous channel of this logger.

pub fn kvfilter(&mut self, parameters: KVFilterParameters) -> &mut Self[src]

Sets KVFilter.

pub fn truncate(&mut self) -> &mut Self[src]

By default, logger just appends log messages to file. If this method called, logger truncates the file to 0 length when opening.

pub fn rotate_size(&mut self, size: u64) -> &mut Self[src]

Sets the threshold used for determining whether rotate the current log file.

If the byte size of the current log file exceeds this value, the file will be rotated. The name of the rotated file will be "${ORIGINAL_FILE_NAME}.0". If there is a previously rotated file, it will be renamed to "${ORIGINAL_FILE_NAME}.1" before rotation of the current log file. This process is iterated recursively until log file names no longer conflict or rotate_keep limit reached.

The default value is std::u64::MAX.

pub fn rotate_keep(&mut self, count: usize) -> &mut Self[src]

Sets the maximum number of rotated log files to keep.

If the number of rotated log files exceed this value, the oldest log file will be deleted.

The default value is 8.

pub fn rotate_compress(&mut self, compress: bool) -> &mut Self[src]

Sets whether to compress or not compress rotated files.

If true is specified, rotated files will be compressed by GZIP algorithm and the suffix ".gz" will be appended to those file names.

The default value is false.

Trait Implementations

impl Build for FileLoggerBuilder[src]

impl Debug for FileLoggerBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Erased for T