tracing_appender

Module rolling

Source
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§

Builder
A builder for configuring RollingFileAppenders.
InitError
Errors returned by Builder::build.
RollingFileAppender
A file appender with the ability to rotate log files at a fixed schedule.
RollingWriter
A writer that writes to a rolling log file.
Rotation
Defines a fixed period for rolling of a log file.

Functions§

daily
Creates a daily-rotating file appender.
hourly
Creates an hourly-rotating file appender.
minutely
Creates a minutely-rotating file appender. This will rotate the log file once per minute.
never
Creates a non-rolling file appender.