| Crates.io | async-log-watch |
| lib.rs | async-log-watch |
| version | 0.2.0 |
| created_at | 2023-05-04 04:09:45.305244+00 |
| updated_at | 2023-05-07 01:24:03.149242+00 |
| description | A simple Rust library to monitor log files and trigger an async callback when a new line is added. |
| homepage | |
| repository | https://github.com/geminik23/async-log-watch |
| max_upload_size | |
| id | 856221 |
| size | 59,277 |
async_log_watch is a simple Rust library developed as a part of a personal project. It is designed to monitor log files and trigger an async callback whenever a new line is added to the file. The library allows users to easily integrate log file monitoring into their projects, with support for monitoring multiple log files simultaneously.
The primary motivation behind creating this library was to efficiently detect new log lines generated by tools like pm2. The library is built using the async-std (can use the tokio by adding tokio runtime feature) and the notify crate for file system event monitoring.
Add async-log-watch to your Cargo.toml dependencies:
[dependencies]
async-log-watch = {version = "0.2"}
For a example demonstrating the usage of this library, please refer to the example code in the examples folder.
This crate allows you to use tokio runtime featured in async-std by specifying features in your Cargo.toml. By default, it uses async-std with the attributes feature.
To use the crate with the default configuration, add the following line to your Cargo.toml:
async-log-watch = "0.2"
To use a specific Tokio configuration, specify the feature like this:
async-log-watch = { version = "0.2", features = ["tokio1"] }
async-std with the attributes feature.async-std with the attributes and tokio1 features.async-std with the attributes and tokio02 features.async-std with the attributes and tokio03 features.Please note that you should only enable one of these features at a time.
thiserror library. - file errors occurs in spawn.LogEvent that encapsulates the line, path and LogError object.support tokio runtime
Add filtering options to process specific log lines based on patterns
Add filtering option
This project is licensed under the MIT License - see the LICENSE file for details.