Crate rolling_file_opt

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§

  • Implements a rolling condition based on a certain frequency and/or a size limit. The default condition is to rotate daily.
  • 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§

Traits§

Type Aliases§