Module tracing_appender::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 ofsome_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 ofsome_directory/log_file_name_prefix.yyyy-MM-dd-HH
will be created hourlyRotation::daily()
: A new log file in the format ofsome_directory/log_file_name_prefix.yyyy-MM-dd
will be created dailyRotation::never()
: This will result in log file located atsome_directory/log_file_name
Examples
use tracing_appender::rolling::{RollingFileAppender, Rotation};
let file_appender = RollingFileAppender::new(Rotation::HOURLY, "/some/directory", "prefix.log");
Structs
- A file appender with the ability to rotate log files at a fixed schedule.
- A writer that writes to a rolling log file.
- Defines a fixed period for rolling of a log file.
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