🛈 Note: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem.

For the release documentation, please see docs.rs, instead.

tracing_appender::rolling

Function never

Source
pub fn never(
    directory: impl AsRef<Path>,
    file_name: impl AsRef<Path>,
) -> RollingFileAppender 
Expand description

Creates a non-rolling file appender.

The appender returned by rolling::never can be used with non_blocking to create a non-blocking, non-rotating appender.

The location of the log file will be specified the directory passed in. file_name specifies the complete name of the log file (no date or time is appended).

§Examples

fn main () {
    let appender = tracing_appender::rolling::never("/some/path", "non-rolling.log");
    let (non_blocking_appender, _guard) = tracing_appender::non_blocking(appender);

    let collector = tracing_subscriber::fmt().with_writer(non_blocking_appender);

    tracing::collect::with_default(collector.finish(), || {
        tracing::event!(tracing::Level::INFO, "Hello");
    });
}

This will result in a log file located at /some/path/non-rolling.log.