rust-vector-logger

Crates.iorust-vector-logger
lib.rsrust-vector-logger
version0.1.18
sourcesrc
created_at2024-05-05 15:13:53.641579
updated_at2024-06-07 04:38:15.905862
descriptionA simple logger for Rust that logs to a vector
homepage
repositoryhttps://github.com/cesan3/rust-vector-logger
max_upload_size
id1230274
size39,120
Cesar Augusto Sanchez (cesan3)

documentation

README

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"));
Commit count: 57

cargo fmt