#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

#16 in #watcher

Download history 33/week @ 2024-03-11 37/week @ 2024-03-18 38/week @ 2024-03-25 89/week @ 2024-04-01 14/week @ 2024-04-08 23/week @ 2024-04-15 32/week @ 2024-04-22 15/week @ 2024-04-29 53/week @ 2024-05-06 25/week @ 2024-05-13 40/week @ 2024-05-20 19/week @ 2024-05-27 23/week @ 2024-06-03 18/week @ 2024-06-10 31/week @ 2024-06-17 26/week @ 2024-06-24

102 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