2 releases

0.1.3 Oct 8, 2025
0.1.2 Oct 8, 2025
0.1.1 Oct 8, 2025

#924 in Debugging

MIT/Apache

17KB
151 lines

ribo

A collection of common utilities for Rust projects.

Features

  • Logging: Re-exports tracing and provides utility functions for initializing logging with a pre-configured format
  • I/O utilities: Download and JSON utilities
  • Name utilities: Codename generation functionality

Logging

The logging utilities provide a pre-configured tracing setup with:

  • Environment filter using RUST_LOG environment variable
  • Target information included in logs
  • File and line number information
  • RFC3339 formatted timestamps in local time
  • Colored output enabled by default

Example Usage

use ribo::utils::log;
use ribo::utils::log::{debug, error, info, warn};
use ribo::utils::log::{init_log, LogLevel};

fn main() {
    println!("Testing default logging configuration...");
    init_log(LogLevel::INFO);

    info!("Info message with default config");
    debug!("Debug message (might not show depending on RUST_LOG)");
    warn!("Warning message");
    error!("Error message");
}

For more advanced configuration:

use ribo::log;

fn main() {
    // Initialize with custom filter
    log::init_with_filter("info", true);  // Show info and above, with colors
    
    // Or use the basic init
    log::init_log();
}

The module re-exports tracing, so projects using ribo don't need to depend on tracing directly.

Dependencies

~16–34MB
~391K SLoC