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//!     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, a file, or both
26//! - Environment-filter support via [`EnvFilter`](tracing_subscriber::EnvFilter)
27//!   (`"info,my_crate=debug"`, `RUST_LOG`, etc.)
28//! - Fluent builder API with sensible defaults
29//! - Safe initialisation — never panics on double-init
30
31#![deny(missing_docs)]
32
33/// Logger builder and initialisation logic.
34pub mod config;
35/// Error types returned by the library.
36pub mod errors;
37/// Custom timestamp formatter for log lines.
38pub mod time;
39
40pub use tracing::{Level, debug, error, info, trace, warn};
41
42pub use config::{LogFormat, Logger, Output};