Crates.io | rust-vector-logger |
lib.rs | rust-vector-logger |
version | 0.1.18 |
source | src |
created_at | 2024-05-05 15:13:53.641579 |
updated_at | 2024-06-07 04:38:15.905862 |
description | A simple logger for Rust that logs to a vector |
homepage | |
repository | https://github.com/cesan3/rust-vector-logger |
max_upload_size | |
id | 1230274 |
size | 39,120 |
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.
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"));