logfmt — log string formatting cheat sheet

{}Display

tracing::info!("hello {}, the answer is {}", "world", 42);
2026-05-09T14:15:15.224467Z  INFO tracing_full: hello world, the answer is 42

{:?}Debug

let users = vec!["alice", "bob", "charlie"];
tracing::info!("users: {:?}", users);
2026-05-09T14:15:15.225942Z  INFO tracing_full: users: ["alice", "bob", "charlie"]

{:#?} — pretty Debug

#[derive(Debug)]
struct User { name: &'static str, age: u32, roles: Vec<&'static str> }

let user = User { name: "alice", age: 30, roles: vec!["admin", "editor"] };
tracing::info!("user: {:#?}", user);
2026-05-09T14:15:15.227643Z  INFO tracing_full: user: User {
    name: "alice",
    age: 30,
    roles: [
        "admin",
        "editor",
    ],
}

{name} — implicit named-argument capture (Rust 2021+)

let name = "alice";
let age = 30;
tracing::info!("user {name} is {age} years old");
2026-05-09T14:15:15.229968Z  INFO tracing_full: user alice is 30 years old

{:x}, {:o}, {:b} — hex, octal, binary

let n = 255u32;
tracing::info!("hex={:x}  octal={:o}  binary={:b}", n, n, n);
2026-05-09T14:15:15.231669Z  INFO tracing_full: hex=ff  octal=377  binary=11111111

{:>5} — padding

let n = 255u32;
tracing::info!("padded={:>5}", n);
2026-05-09T14:15:15.233263Z  INFO tracing_full: padded=  255

{:.2} — precision

tracing::info!("precision={:.2}", 3.14159);
2026-05-09T14:15:15.234764Z  INFO tracing_full: precision=3.14

info!(field = value), ?value (Debug), %value (Display) — structured fields with sigils

tracing::info!(answer = 42, "plain value");
tracing::info!(items = ?vec![1, 2, 3], "? sigil = Debug");
tracing::info!(name = %"world", "% sigil = Display");
2026-05-09T14:15:15.236170Z  INFO tracing_full: plain value answer=42
2026-05-09T14:15:15.236193Z  INFO tracing_full: ? sigil = Debug items=[1, 2, 3]
2026-05-09T14:15:15.236202Z  INFO tracing_full: % sigil = Display name=world