#rolling #logging #tracing

rolling-file

可自定义滚动条件的滚动文件追加器

2 个不稳定版本

0.2.0 2023年1月14日
0.1.0 2021年3月31日

#207 in 调试

Download history • Rust 包仓库 22306/week @ 2024-03-14 • Rust 包仓库 23142/week @ 2024-03-21 • Rust 包仓库 21169/week @ 2024-03-28 • Rust 包仓库 25293/week @ 2024-04-04 • Rust 包仓库 24112/week @ 2024-04-11 • Rust 包仓库 28232/week @ 2024-04-18 • Rust 包仓库 23962/week @ 2024-04-25 • Rust 包仓库 24571/week @ 2024-05-02 • Rust 包仓库 23608/week @ 2024-05-09 • Rust 包仓库 20342/week @ 2024-05-16 • Rust 包仓库 18925/week @ 2024-05-23 • Rust 包仓库 25259/week @ 2024-05-30 • Rust 包仓库 26155/week @ 2024-06-06 • Rust 包仓库 26340/week @ 2024-06-13 • Rust 包仓库 24983/week @ 2024-06-20 • Rust 包仓库 21017/week @ 2024-06-27 • Rust 包仓库

103,660 每月下载量
用于 36 个crate (5 直接)

MIT/Apache

28KB
507

rolling-file

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

具有可自定义滚动条件的滚动文件追加器。包括对日期/时间(每日、每小时、每分钟)和/或大小的内置支持。

遵循 Debian 风格的日志文件命名约定,使用 basename, basename.1, ..., basename.N,其中 N 是允许的历史日志文件的最大数量。

这可以与 tracing crate 和 tracing_appender::non_blocking::NonBlocking 结合使用 -- 作为 tracing_appender::rolling::RollingFileAppender 的替代方案。

示例

use rolling_file::*;
let file_appender = BasicRollingFileAppender::new(
    "/var/log/myprogram",
    RollingConditionBasic::new().daily(),
    9
).unwrap();

开发

必须通过最新的稳定版 clippy,用 nightly rustfmt 格式化,并通过单元测试

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

许可证

双许可,根据 MIT 许可证或 Apache 2.0 许可证的条款。

变更日志

CHANGELOG.md

依赖关系

~1MB
~18K SLoC