ribo

Crates.ioribo
lib.rsribo
version0.1.3
created_at2025-10-08 03:57:15.342881+00
updated_at2025-10-08 04:21:56.228813+00
descriptionRibo for universe, provide tons of util functions.
homepagehttps://github.com/lucasjinreal/ribo
repositoryhttps://github.com/lucasjinreal/ribo
max_upload_size
id1873420
size57,593
MagicSource (lucasjinreal)

documentation

https://docs.rs/ribo

README

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.

Commit count: 0

cargo fmt