rotating-file

Crates.iorotating-file
lib.rsrotating-file
version0.3.6
sourcesrc
created_at2021-01-17 10:14:31.964976
updated_at2022-04-16 09:57:55.714608
descriptionA thread-safe rotating file with customizable rotation behavior.
homepage
repositoryhttps://github.com/soulmachine/rotating-file
max_upload_size
id343078
size32,166
Frank Dai (soulmachine)

documentation

README

rotating-file

A thread-safe rotating file with customizable rotation behavior.

Example

use rotating_file::RotatingFile;

fn main() {
    let root_dir = "./target/tmp";
    let s = "The quick brown fox jumps over the lazy dog";

    // rotated by 1 kilobyte, compressed with gzip
    let rotating_file = RotatingFile::new(root_dir, Some(1), None, None, None, None, None);
    for _ in 0..24 {
        rotating_file.writeln(s).unwrap();
    }
    rotating_file.close();

    assert_eq!(2, std::fs::read_dir(root_dir).unwrap().count());
    std::fs::remove_dir_all(root_dir).unwrap();
}
Commit count: 13

cargo fmt