#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

#17 in #watcher

Download history 29/week @ 2024-11-27 45/week @ 2024-12-04 92/week @ 2024-12-11 53/week @ 2024-12-18 21/week @ 2024-12-25 4/week @ 2025-01-01 13/week @ 2025-01-08 40/week @ 2025-01-15 14/week @ 2025-01-22 17/week @ 2025-01-29 51/week @ 2025-02-05 81/week @ 2025-02-12 20/week @ 2025-02-19 44/week @ 2025-02-26 11/week @ 2025-03-05 47/week @ 2025-03-12

131 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