pub struct FileLogWriter { /* private fields */ }
Expand description

A configurable LogWriter implementation that writes to a file or a sequence of files.

See writers for usage guidance.

Implementations

Instantiates a builder for FileLogWriter.

Returns a reference to its configured output format function.

Replaces parts of the configuration of the file log writer.

Note that the write mode and the format function cannot be reset and that the provided FileLogWriterBuilder must have the same values for these as the current FileLogWriter.

Errors

FlexiLoggerError::Reset if a reset was tried with a different write mode.

FlexiLoggerError::Io if the specified path doesn’t work.

FlexiLoggerError::OutputBadDirectory if the specified path is not a directory.

FlexiLoggerError::Poison if some mutex is poisoned.

Returns the current configuration of the file log writer

Errors

FlexiLoggerError::Poison if some mutex is poisoned.

Makes the FileLogWriter re-open the current log file.

FileLogWriter expects that nobody else modifies the file to which it writes, and offers capabilities to rotate, compress, and clean up log files.

However, if you use tools like linux’ logrotate to rename or delete the current output file, you need to inform the FileLogWriter about such actions by calling this method. Otherwise the FileLogWriter will not stop writing to the renamed or even deleted file!

Example

logrotate e.g. can be configured to send a SIGHUP signal to your program. You should handle SIGHUP in your program explicitly, e.g. using a crate like ctrlc, and call this function from the registered signal handler.

Errors

FlexiLoggerError::Poison if some mutex is poisoned.

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Writes out a log line. Read more

Flushes any buffered records. Read more

Provides the maximum log level that is to be written.

Cleanup open resources, if necessary.

Sets the format function. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Use this to cast from one trait object type to another. Read more

Use this to upcast a trait to one of its supertraits. Read more

Use this to cast from one trait object type to another. This method is more customizable than the dyn_cast method. Here you can also specify the “source” trait from which the cast is defined. This can for example allow using casts from a supertrait of the current trait object. Read more

Use this to cast from one trait object type to another. With this method the type parameter is a config type that uniquely specifies which cast should be preformed. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.