#logging #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

#24 in #watcher

Download history 49/week @ 2025-10-21 19/week @ 2025-10-28 19/week @ 2025-11-04 18/week @ 2025-11-11 23/week @ 2025-11-18 21/week @ 2025-11-25 27/week @ 2025-12-02 20/week @ 2025-12-09 22/week @ 2025-12-16 27/week @ 2025-12-23 20/week @ 2025-12-30 5/week @ 2026-01-06 16/week @ 2026-01-13 26/week @ 2026-01-20 21/week @ 2026-01-27 15/week @ 2026-02-03

78 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