#tokio #vector #logging #logger #async #async-std

rust-vector-logger

A simple logger for Rust that logs to a vector

15 releases

0.1.18 Jun 7, 2024
0.1.17 Jun 5, 2024
0.1.9 May 23, 2024

#563 in Debugging

Download history 1/week @ 2024-07-02 64/week @ 2024-07-30

906 downloads per month

Apache-2.0

24KB
566 lines

rust-vector-logger

This is a simple logger that logs to vector. It is useful for testing and debugging. It uses tokio to send logs to the vector.

Usage

use rust_vector_logger::Logger;

#[tokio::main]
async fn main() {
    let host = "127.0.0.1"; // The vector host address
    let port = 12345; // The vector port
    let level = "INFO"; // The log level

    let mut logger = Logger::init("AppName", &level, &host, port).await.unwrap();
    logger.info("Hello, world!");
    logger.infof(format_args!("Hello, {}", "world"));

    logger.debug("This is a debug message");
    logger.warnf(format_args!("This is a warning message for {}", "you"));

Dependencies

~7–18MB
~222K SLoC