Struct otter::prelude::flexi_logger::writers::FileLogWriter
[−]pub struct FileLogWriter { /* private fields */ }
Expand description
Implementations
impl FileLogWriter
impl FileLogWriter
pub fn builder(file_spec: FileSpec) -> FileLogWriterBuilder
pub fn builder(file_spec: FileSpec) -> FileLogWriterBuilder
Instantiates a builder for FileLogWriter
.
pub fn format(
&self
) -> fn(&mut dyn Write, &mut DeferredNow, &Record<'_>) -> Result<(), Error>
pub fn format(
&self
) -> fn(&mut dyn Write, &mut DeferredNow, &Record<'_>) -> Result<(), Error>
Returns a reference to its configured output format function.
pub fn reset(&self, flwb: &FileLogWriterBuilder) -> Result<(), FlexiLoggerError>
pub fn reset(&self, flwb: &FileLogWriterBuilder) -> Result<(), FlexiLoggerError>
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.
pub fn config(&self) -> Result<FileLogWriterConfig, FlexiLoggerError>
pub fn config(&self) -> Result<FileLogWriterConfig, FlexiLoggerError>
Returns the current configuration of the file log writer
Errors
FlexiLoggerError::Poison
if some mutex is poisoned.
pub fn reopen_outputfile(&self) -> Result<(), FlexiLoggerError>
pub fn reopen_outputfile(&self) -> Result<(), FlexiLoggerError>
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
impl Debug for FileLogWriter
impl Debug for FileLogWriter
impl Drop for FileLogWriter
impl Drop for FileLogWriter
impl LogWriter for FileLogWriter
impl LogWriter for FileLogWriter
fn write(&self, now: &mut DeferredNow, record: &Record<'_>) -> Result<(), Error>
fn write(&self, now: &mut DeferredNow, record: &Record<'_>) -> Result<(), Error>
Writes out a log line. Read more
fn max_log_level(&self) -> LevelFilter
fn max_log_level(&self) -> LevelFilter
Provides the maximum log level that is to be written.
fn shutdown(&self)
fn shutdown(&self)
Cleanup open resources, if necessary.
Auto Trait Implementations
impl RefUnwindSafe for FileLogWriter
impl Send for FileLogWriter
impl Sync for FileLogWriter
impl Unpin for FileLogWriter
impl UnwindSafe for FileLogWriter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
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
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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
sourceimpl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> DowncastSync for T where
T: Any + Send + Sync,
sourceimpl<A> DynCastExt for A
impl<A> DynCastExt for A
sourcefn dyn_cast<T>(
self
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source> where
A: DynCastExtHelper<T>,
T: ?Sized,
fn dyn_cast<T>(
self
) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source> where
A: DynCastExtHelper<T>,
T: ?Sized,
Use this to cast from one trait object type to another. Read more
sourcefn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target where
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
T: ?Sized,
fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target where
A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>,
T: ?Sized,
Use this to upcast a trait to one of its supertraits. Read more
sourcefn dyn_cast_adv<F, T>(
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
T: ?Sized,
fn dyn_cast_adv<F, T>(
self
) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source> where
A: DynCastExtAdvHelper<F, T>,
F: ?Sized,
T: ?Sized,
sourcefn dyn_cast_with_config<C>(
self
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source> where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
fn dyn_cast_with_config<C>(
self
) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source> where
C: DynCastConfig,
A: DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>,
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