[−][src]Function tracing_appender::rolling::minutely
pub fn minutely(
directory: impl AsRef<Path>,
file_name_prefix: impl AsRef<Path>
) -> RollingFileAppenderⓘImportant traits for RollingFileAppender
impl Write for RollingFileAppender
Creates a minutely, rolling file appender. This will rotate the log file once per minute.
The appender returned by rolling::minutely
can be used with non_blocking
to create
a non-blocking, minutely file appender.
The directory of the log file is specified with the directory
argument.
file_name_prefix
specifies the prefix of the log file. RollingFileAppender
adds the current date, hour, and minute to the log file in UTC.
Examples
fn main () { let appender = tracing_appender::rolling::minutely("/some/path", "rolling.log"); let (non_blocking_appender, _guard) = tracing_appender::non_blocking(appender); let subscriber = tracing_subscriber::fmt().with_writer(non_blocking_appender); tracing::subscriber::with_default(subscriber.finish(), || { tracing::event!(tracing::Level::INFO, "Hello"); }); }
This will result in a log file located at /some/path/rolling.log.yyyy-MM-dd-HH-mm
.