#rolling #logging #tracing

tracing-rolling-file

A rolling file appender with customizable rolling conditions

2 releases

0.1.2 Sep 26, 2023
0.1.1 Aug 16, 2022
0.1.0 Aug 16, 2022

#162 in Debugging

Download history 130/week @ 2023-08-12 145/week @ 2023-08-19 324/week @ 2023-08-26 197/week @ 2023-09-02 474/week @ 2023-09-09 177/week @ 2023-09-16 487/week @ 2023-09-23 271/week @ 2023-09-30 429/week @ 2023-10-07 351/week @ 2023-10-14 706/week @ 2023-10-21 388/week @ 2023-10-28 595/week @ 2023-11-04 656/week @ 2023-11-11 676/week @ 2023-11-18 446/week @ 2023-11-25

2,438 downloads per month

MIT/Apache

23KB
402 lines

tracing-rolling-file

tracing-rolling-file on GitHub Actions tracing-rolling-file on crates.io tracing-rolling-file on docs.rs GitHub: cavivie/tracing-rolling-file license: MIT or Apache-2.0 minimum rustc: 1.42

A rolling file appender with customizable rolling conditions, based on rolling-file. Includes built-in support for rolling conditions on date/time (daily, hourly, every minute) and/or size.

Follows a Debian-style naming convention for logfiles, using basename, basename.1, ..., basename.N where N is the maximum number of allowed historical logfiles.

This is useful to combine with the tracing crate and tracing_appender::non_blocking::NonBlocking -- use it as an alternative to tracing_appender::rolling::RollingFileAppender.

Examples

use tracing_rolling_file::*;
let file_appender = RollingFileAppenderBase::new(
    "/var/log/myprogram",
    RollingConditionBase::new().daily(),
    9
).unwrap();

Development

Must pass latest stable clippy, be formatted with nightly rustfmt, and pass unit tests:

cargo +nightly fmt
cargo clippy --all-targets
cargo test

License

Dual-licensed under the terms of either the MIT license or the Apache 2.0 license.

Dependencies

~1MB
~17K SLoC