Crate 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.

Follows a Debian-style naming convention for logfiles, using basename, basename.1, …, basename.N where N is the maximum number of allowed historical logfiles.

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(
    "/var/log/myprogram",
    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

Determines how often a file should be rolled over

Traits

Determines when a file should be “rolled over”.

Type Definitions

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