Skip to content

A rotating file with customizable rotation behavior.

License

Notifications You must be signed in to change notification settings

getditto/rotating-file

 
 

Repository files navigation

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();
}

About

A rotating file with customizable rotation behavior.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 93.8%
  • Nix 6.1%
  • Shell 0.1%