#log #watcher #tail

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

#36 in #watcher

Download history 63/week @ 2023-11-02 56/week @ 2023-11-09 61/week @ 2023-11-16 47/week @ 2023-11-23 36/week @ 2023-11-30 45/week @ 2023-12-07 51/week @ 2023-12-14 48/week @ 2023-12-21 27/week @ 2023-12-28 37/week @ 2024-01-04 54/week @ 2024-01-11 54/week @ 2024-01-18 32/week @ 2024-01-25 23/week @ 2024-02-01 54/week @ 2024-02-08 61/week @ 2024-02-15

180 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