#log #tail #watcher

bin+lib logwatcher

A lib to watch log files for new Changes, just like tail -f

2 releases

Uses old Rust 2015

0.1.1 Aug 21, 2020
0.1.0 Jan 4, 2016

#20 in #watcher

Download history 2/week @ 2023-12-04 2/week @ 2023-12-11 9/week @ 2023-12-18 4/week @ 2023-12-25 6/week @ 2024-01-08 7/week @ 2024-01-15 4/week @ 2024-02-05 10/week @ 2024-02-12 46/week @ 2024-02-19 57/week @ 2024-02-26 28/week @ 2024-03-04 33/week @ 2024-03-11 37/week @ 2024-03-18

167 downloads per month
Used in 3 crates

MIT/Apache

7KB
133 lines

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(&mut move |line: String| {
    println!("Line {}", line);
    LogWatcherAction::None
});

No runtime deps