alumy 0.1.6

Rust SDK for embedded systems development, providing safe and efficient hardware abstraction and device control.
Documentation

alumy

Crates.io Documentation License

Rust SDK for embedded systems development, providing safe and efficient hardware abstraction and device control.

Features

  • Advanced Logging: A high-performance, non-blocking logger with fluent configuration API, log rotation, and system uptime timestamps.
  • System Utilities: Helpers for system information like uptime.
  • Filesystem Utilities: Size parsing/formatting and path building helpers.
  • Version Management: Macros and functions to access crate metadata at compile time.

Installation

Add this to your Cargo.toml:

[dependencies]
alumy = "0.1"

Usage

Logging Setup

Alumy provides a modern, non-blocking logger based on tracing. It supports a fluent API for easy configuration:

use alumy::LogConfig;

fn main() -> anyhow::Result<()> {
    // Basic setup
    LogConfig::new("my-app", "info").init()?;

    // Advanced setup with log rotation and system uptime
    LogConfig::new("my-app", "debug")
        .with_file("logs/app.log", "10M", 5)
        .with_time_format("uptime")
        .with_ansi(true)
        .with_target(true)
        .init()?;

    tracing::info!("Hello, alumy logger!");
    Ok(())
}

System Uptime

Access system uptime information:

use alumy::sys::uptime;

fn main() {
    println!("Uptime: {} seconds", uptime::uptime());
    println!("Uptime duration: {:?}", uptime::uptime_duration());
}

Filesystem Utilities

Parse and format file sizes easily:

use alumy::fs::filesize;

fn main() {
    let size = filesize::parse_size("10M").unwrap();
    println!("10M in bytes: {}", size);
    println!("Formatted: {}", filesize::format_size(size)); // "10.0MB"
}

Version Information

Access crate metadata:

use alumy::version;
use alumy::{crate_name, crate_version};

fn main() {
    println!("Running {} v{}", crate_name!(), crate_version!());
    println!("{}", version::hello());
}

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Links