2 releases
Uses old Rust 2015
0.1.1 | Aug 21, 2020 |
---|---|
0.1.0 | Jan 4, 2016 |
#16 in #watcher
102 downloads per month
Used in 3 crates
7KB
133 lines
Log Watcher
A Rust library to watch the log files.
Note: Tested only in Linux
Features:
- Automatically reloads log file when log rotated
- Calls callback function when new line to parse
Usage
First, add the following to your Cargo.toml
[dependencies]
logwatcher = "0.1"
Add to your code,
extern crate logwatcher;
use logwatcher::LogWatcher;
Register the logwatcher, pass a closure and watch it!
let mut log_watcher = LogWatcher::register("/var/log/check.log".to_string()).unwrap();
log_watcher.watch(&mut move |line: String| {
println!("Line {}", line);
LogWatcherAction::None
});