pub struct ArcFileLogWriter(/* private fields */);
Expand description
A shareable FileLogWriter
with a handle.
Methods from Deref<Target = FileLogWriter>§
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub fn rotate(&self) -> Result<(), FlexiLoggerError>
pub fn rotate(&self) -> Result<(), FlexiLoggerError>
Trigger an extra log file rotation.
Does nothing if rotation is not configured.
§Errors
FlexiLoggerError::Poison
if some mutex is poisoned.
IO errors.
Sourcepub fn existing_log_files(
&self,
selector: &LogfileSelector,
) -> Result<Vec<PathBuf>, FlexiLoggerError>
pub fn existing_log_files( &self, selector: &LogfileSelector, ) -> Result<Vec<PathBuf>, FlexiLoggerError>
Returns the list of existing log files according to the current FileSpec
.
The list includes the current log file and the compressed files, if they exist.
§Errors
FlexiLoggerError::Poison
if some mutex is poisoned.
Trait Implementations§
Source§impl Clone for ArcFileLogWriter
impl Clone for ArcFileLogWriter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Write for ArcFileLogWriter
impl Write for ArcFileLogWriter
Source§fn write(&mut self, buffer: &[u8]) -> Result<usize, Error>
fn write(&mut self, buffer: &[u8]) -> Result<usize, Error>
Source§fn flush(&mut self) -> Result<(), Error>
fn flush(&mut self) -> Result<(), Error>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored
)