No description
Find a file
noyez 6f8f9bd75d
Change closure from Fn to FnMut. (#5)
* Using FnMut, so works
* Using FnMut for watch() and reopen_if_log_rotated()
* adding fn to force reopen
* adding actions to closure

Co-authored-by: noyez <brad@bkn.local>
Co-authored-by: noyez <brad@bkn.localdomain>
Co-authored-by: Bradley Noyes <b@noyes.dev>
2020-08-21 12:12:11 +05:30
src Change closure from Fn to FnMut. (#5) 2020-08-21 12:12:11 +05:30
.gitignore First working commit 2016-01-04 16:21:41 +05:30
.travis.yml Apply and configure rustfmt in the project 2018-11-29 12:07:09 +01:00
Cargo.toml Change closure from Fn to FnMut. (#5) 2020-08-21 12:12:11 +05:30
README.md Highlight code blocks inside Readme 2018-11-29 12:07:22 +01:00

Log Watcher

Build Status

A Rust library to watch the log files.

Note: Tested only in Linux

Features:

  1. Automatically reloads log file when log rotated
  2. 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);
});