ferrox-logger 0.3.0

Structured JSON logging subscriber, Sentry integration, and Merkle root cryptographic log chain auditing for Ferrox.
Documentation

Ferrox Logger (ferrox-logger)

Crates.io Documentation License

ferrox-logger sets up production-ready, structured JSON logging, Sentry telemetry, and cryptographic SHA-256 Merkle root log chain auditing for Ferrox and Rust applications.


🔑 Key Features

  • 📝 Structured JSON Output: Standardized log format with timestamps, severity levels, module targets, and OpenTelemetry trace IDs.
  • 🔗 MerkleLogLedger: Cryptographic SHA-256 Merkle root computation over structured log blocks for tamper-evident auditing and regulatory compliance.
  • 🚨 Sentry Integration: Automatic panic and critical error event reporting to Sentry APM.
  • 🎛️ Environmental Filtering: Configurable log level thresholds via RUST_LOG environment variables.

🚀 Quickstart Usage

Add ferrox-logger to your Cargo.toml:

[dependencies]
ferrox-logger = "0.1.2"
tracing = "0.1"

1. Setup Structured JSON Logging & Sentry

use ferrox_logger::{setup_logger, LoggerConfig};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let _sentry_guard = setup_logger(LoggerConfig {
        service_name: "my-service".to_string(),
        environment: "production".to_string(),
        otlp_endpoint: None,
        sentry_dsn: None,
        log_level: "info".to_string(),
    })?;

    tracing::info!("Application booted successfully");
    Ok(())
}

2. Cryptographic Merkle Log Audit Chain (MerkleLogLedger)

use ferrox_logger::merkle::MerkleLogLedger;

fn main() {
    let mut ledger = MerkleLogLedger::new();
    ledger.record_log("sys_audit", "User auth success: usr_102");
    ledger.record_log("sys_audit", "Role updated: usr_102 -> admin");

    let root_hash = ledger.compute_merkle_root();
    println!("Tamper-evident Merkle Root: {}", root_hash);
}

📜 License

Licensed under either of:

at your option.