#log-file #log-level #file-path #http #redirect #response #request

hyperlane-log

A Rust asynchronous logging library that runs on a dedicated thread to avoid blocking other threads. It supports multiple log levels (such as error, info, and debug), and allows custom log handling methods and configuration of log file paths. When a single log file reaches the specified size limit, a new log file will be automatically created.

21 releases (12 breaking)

new 0.12.0 Jan 4, 2025
0.10.0 Jan 4, 2025
0.5.0 Dec 31, 2024

#1630 in Network programming

Download history 1238/week @ 2024-12-28

1,243 downloads per month
Used in 2 crates

MIT license

14KB
271 lines

hyperlane-log

Official Documentation

Api Docs

A Rust asynchronous logging library that runs on a dedicated thread to avoid blocking other threads. It supports multiple log levels (such as error, info, and debug), and allows custom log handling methods and configuration of log file paths. When a single log file reaches the specified size limit, a new log file will be automatically created.

Features

Installation

To use this crate, you can run cmd:

cargo add hyperlane-log

Log Storage Location Description

Three directories will be created under the user-specified directory: one for error logs, one for info logs, and one for debug logs. Each of these directories will contain a subdirectory named by the date, and the log files within these subdirectories will be named in the format timestamp.index.log.

Use

use hyperlane_log::*;
let log: Log = Log::new("./logs", 1_024_000);
let log_thread: JoinHandle<()> = log_run(&log);
log.log_error("error data => ", |error| {
    let write_data: String = format!("User error func =>  {:?}\n", error);
    write_data
});
log.log_info("info data => ", |info| {
    let write_data: String = format!("User info func =>  {:?}\n", info);
    write_data
});
log.log_debug("debug data => ", |debug| {
    let write_data: String = format!("User debug func =>  {:#?}\n", debug);
    write_data
});
let _ = log_thread.join();

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Contact

For any inquiries, please reach out to the author at ltpp-universe root@ltpp.vip.

Dependencies

~11MB
~354K SLoC