#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

#19 in #watcher

Download history 16/week @ 2024-07-22 61/week @ 2024-07-29 16/week @ 2024-08-05 26/week @ 2024-08-12 11/week @ 2024-08-19 28/week @ 2024-08-26 29/week @ 2024-09-02 20/week @ 2024-09-09 29/week @ 2024-09-16 76/week @ 2024-09-23 34/week @ 2024-09-30 5/week @ 2024-10-07 40/week @ 2024-10-14 24/week @ 2024-10-21 27/week @ 2024-10-28 26/week @ 2024-11-04

117 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