vigilant

Crates.iovigilant
lib.rsvigilant
version1.0.4
created_at2025-01-28 23:42:07.170406+00
updated_at2025-01-30 22:06:03.68271+00
descriptionThe Rust SDK for the Vigilant platform.
homepagehttps://vigilant.run
repositoryhttps://github.com/vigilant-run/vigilant-rust
max_upload_size
id1534182
size68,618
Izak Fritz (izakfr)

documentation

README

Vigilant Rust SDK

This is the Rust SDK for the Vigilant platform.

Installation

cargo add vigilant

Usage (with tracing adapter)

use tracing::info;
use tracing_subscriber::prelude::*;
use vigilant::TracingAdapterBuilder;

fn main() {
  let adapter = TracingAdapterBuilder::new()
    .name("rust-app")
    .token("tk_1234567890")
    .build();

  tracing_subscriber::registry().with(adapter.clone()).init();

  info!("Hello, world!");

  adapter.shutdown().expect("Failed to shutdown adapter");
}

Usage (with log adapter)

use log::{debug, info};
use vigilant::EnvLoggerAdapterBuilder;

fn main() {
  let adapter = EnvLoggerAdapterBuilder::new()
    .name("rust-app")
    .token("tk_1234567890")
    .build();

  log::set_max_level(log::LevelFilter::Debug);
  log::set_boxed_logger(Box::new(adapter.clone())).expect("Failed to set logger");

  info!("Starting application");
  debug!("Debug message");

  adapter.shutdown().expect("Failed to shutdown adapter");
}

Usage (standard logger)

use vigilant::LoggerBuilder;

fn main() {
  let mut logger = LoggerBuilder::new()
    .name("rust-service")
    .token("tk_1234567890")
    .build();

  logger.info("Hello, world!");

  logger.shutdown().expect("Failed to shutdown adapter");
}
Commit count: 9

cargo fmt