Expand description

A rolling file appender.

Creates a new log file at a fixed frequency as defined by Rotation. Logs will be written to this file for the duration of the period and will automatically roll over to the newly created log file once the time period has elapsed.

The log file is created at the specified directory and file name prefix which may be appended with the date and time.

The following helpers are available for creating a rolling file appender.

  • Rotation::minutely(): A new log file in the format of some_directory/log_file_name_prefix.yyyy-MM-dd-HH-mm will be created minutely (once per minute)
  • Rotation::hourly(): A new log file in the format of some_directory/log_file_name_prefix.yyyy-MM-dd-HH will be created hourly
  • Rotation::daily(): A new log file in the format of some_directory/log_file_name_prefix.yyyy-MM-dd will be created daily
  • Rotation::never(): This will result in log file located at some_directory/log_file_name

Examples

use tracing_appender::rolling::{RollingFileAppender, Rotation};
let file_appender = RollingFileAppender::new(Rotation::HOURLY, "/some/directory", "prefix.log");

Structs

Functions

  • Creates a file appender that rotates daily.
  • Creates an hourly, rolling file appender.
  • Creates a minutely, rolling file appender. This will rotate the log file once per minute.
  • Creates a non-rolling, file appender