Skip to main content

Crate tiny_tracing

Crate tiny_tracing 

Source
Expand description

§tiny-tracing

A lightweight, builder-style logger for Rust projects that wraps tracing and [tracing-subscriber].

Ideal for small to medium applications that want structured or text output with minimal ceremony.

§Quick start

use tiny_tracing::Logger;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    Logger::new().init()?;

    tiny_tracing::info!("Application started");
    Ok(())
}

§Features

  • Text and JSON output formats
  • Output to stdout, stderr, a file, or stdout and a file at once
  • Environment-filter support via EnvFilter ("info,my_crate=debug"), optionally read from RUST_LOG
  • Fluent builder API with sensible defaults
  • UTC RFC 3339 timestamps, which can be turned off
  • Safe initialisation — never panics on double-init

Re-exports§

pub use config::LogFormat;
pub use config::Logger;
pub use config::Output;

Modules§

config
Logger builder and initialisation logic.
errors
Error types returned by the library.

Macros§

debug
Constructs an event at the debug level.
error
Constructs an event at the error level.
info
Constructs an event at the info level.
trace
Constructs an event at the trace level.
warn
Constructs an event at the warn level.

Structs§

Level
Describes the level of verbosity of a span or event.