tiny-tracing 0.1.0

Simple rusty log library (tracing-subscriber wrapper)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! JSON output at DEBUG level with source file locations enabled.
//!
//! Run with: `cargo run --example json`

use tiny_tracing::{Level, LogFormat, Logger, info, warn};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    Logger::new()
        .with_level(Level::DEBUG)
        .with_format(LogFormat::Json)
        .with_file(true)
        .init()?;

    info!(user_id = 42, action = "login", "structured event");
    warn!("something worth a second look");
    Ok(())
}