Crate local_rolling_file

Source
Expand description

A rolling file appender with customizable rolling conditions. Includes built-in support for rolling conditions on date/time (daily, hourly, every minute) and/or size. Log files structures(with log as folder and log.log as prefix):

  • log.log (a symbol link always points to the latest one log file)
  • log.log.yyyymmdd.hhmmss (e.g. log.log.20240520.010101)
  • ..

This is useful to combine with the tracing crate and tracing_appender::non_blocking::NonBlocking – use it as an alternative to tracing_appender::rolling::RollingFileAppender.

§Examples

let file_appender = BasicRollingFileAppender::new(
    "./log",
    "log.log",
    RollingConditionBasic::new().daily(),
    9
).unwrap();

Structs§

RollingConditionBasic
Implements a rolling condition based on a certain frequency and/or a size limit. The default condition is to rotate daily.
RollingFileAppender
Writes data to a file, and “rolls over” to preserve older data in a separate set of files. Old files have a Debian-style naming scheme where we have base_filename, base_filename.1, …, base_filename.N where N is the maximum number of rollover files to keep.

Enums§

RollingFrequency
Determines how often a file should be rolled over

Traits§

RollingCondition
Determines when a file should be “rolled over”.

Type Aliases§

BasicRollingFileAppender
A rolling file appender with a rolling condition based on date/time or size.