No description
* Allow any generic Path as input to register Previously only String was allowed, which can be annoying for clients which already have a PathBuf or Path object. The generic type AsRef<Path> is the standard for APIs which have file path parameters, as it works across both owned and un-owned paths. Also, AsRef<Path> allows Strings and OS specific strings to be used directly as well. The filename parameter itself is only used for calling File::open(), which itself also takes in an AsRef<Path> as input. Signed-off-by: Kyle Wood <https://github.com/DemonWav> |
||
|---|---|---|
| src | ||
| .gitignore | ||
| .travis.yml | ||
| Cargo.toml | ||
| README.md | ||
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(&|line: String| {
println!("Line {}", line);
});