Deterministic, audit‑transparent logging for Rust binaries
logger is a lightweight, workspace‑safe logging component designed for reproducible automation tools and platform‑grade Rust binaries. It enforces explicit configuration, deterministic log file naming, and append‑only behavior with no hidden state or implicit lifecycle semantics.
This crate focuses on infrastructure: file creation, directory management, archival, and structured log writing. Application‑level semantics remain entirely in the caller’s control.
-
Deterministic log paths
Logs are written toLogs/<binary>.log, where<binary>is derived from the executable name. -
Append‑only, audit‑transparent
No truncation, no implicit rotation, no hidden state. -
Explicit configuration
The caller provides aLoggerConfig; nothing is inferred. -
Workspace‑safe path resolution
Usesenv!("CARGO_MANIFEST_DIR")to ensure reproducibility across machines and CI. -
Minimal, predictable API
info(),warn(),error(), anddebug()write timestamped, structured entries.
Add to your Cargo.toml:
[dependencies] logger = { path = "../logger" }
use logger::{Logger, LoggerConfig};
fn main() -> Result<(), Box> { let config = LoggerConfig::new()?; let logger = Logger::new(config)?;
logger.info("Application started");
logger.debug("Debug details here");
logger.warn("Potential issue detected");
logger.error("An error occurred");
Ok(())
}
🧱 Design Principles Deterministic Initialization All paths and directories are resolved during construction. Failures occur early and explicitly. Binary‑Named Logs If your binary is licensegen, your log file is: Logs/licensegen.log
Infrastructure Only The logger does not:
- guess directories
- infer log levels
- manage formatting beyond timestamps
- rotate logs implicitly It writes structured entries and performs archival only when explicitly requested.
📁 Directory Layout project/ logger/ src/ README.md LICENSE Logs/ .log
The Logs/ directory is created automatically if missing.
🗂 Log Format Each entry is timestamped and structured: 2026-02-25T13:29:00Z [INFO] Application started
🧪 Testing The crate is designed for deterministic tests:
- Temporary directories can be injected via LoggerConfig
- Log output is fully predictable
- No global state or static mutables
🛠 Planned Features These features are not yet implemented, but are part of the long‑term roadmap:
- Explicit archival API Timestamped archive files, optional compression, and daily/monthly/yearly rollup behavior — all opt‑in and caller‑controlled.
- Structured log levels Optional typed log levels with compile‑time filtering.
- JSON log mode Deterministic machine‑readable output for automation pipelines.
📜 License MIT License — see LICENSE in this repository.
🧩 About logger is part of a broader effort to standardize deterministic, audit‑transparent platform components across Rust automation tools. It is intentionally minimal, predictable, and designed for long‑term stability.