Skip to main content

tiny_tracing/
lib.rs

1//! # tiny-tracing
2//!
3//! A lightweight, builder-style logger for Rust projects that wraps
4//! [`tracing`] and [`tracing-subscriber`].
5//!
6//! Ideal for small to medium applications that want structured or
7//! text output with minimal ceremony.
8//!
9//! # Quick start
10//!
11//! ```rust
12//! use tiny_tracing::Logger;
13//!
14//! fn main() -> Result<(), Box<dyn std::error::Error>> {
15//!     let _guard = Logger::new().init()?;
16//!
17//!     tiny_tracing::info!("Application started");
18//!     Ok(())
19//! }
20//! ```
21//!
22//! # Features
23//!
24//! - Text and JSON output formats
25//! - Output to stdout, stderr, a file, or stdout and a file at once; file writes are
26//!   non-blocking (keep the [`LoggerGuard`] returned by `init` alive)
27//! - Environment-filter support via [`EnvFilter`](tracing_subscriber::EnvFilter)
28//!   (`"info,my_crate=debug"`), optionally read from `RUST_LOG`
29//! - Fluent builder API with sensible defaults
30//! - UTC RFC 3339 timestamps, which can be turned off
31//! - Safe initialisation — never panics on double-init
32
33#![deny(missing_docs)]
34
35/// Logger builder and initialisation logic.
36pub mod config;
37/// Error types returned by the library.
38pub mod errors;
39
40pub use tracing::{Level, debug, error, info, trace, warn};
41
42pub use config::{LogFormat, Logger, LoggerGuard, Output};