#[non_exhaustive]pub enum Format {
Auto,
Compact,
Pretty,
Json,
}Expand description
Output format for the fmt layer.
Auto is replaced at init time by Format::Pretty when the chosen sink
is a TTY and Format::Compact otherwise. Set the KAMU_LOG_FORMAT
environment variable (auto, compact, pretty, json) to override
without code changes. On wasm32, Auto resolves to Format::Json for
Cloudflare Workers Logs-friendly console output, and Format::Pretty
falls back to non-ANSI compact output.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Auto
Resolved at init time based on sink + env var.
Compact
Single-line, machine-readable text format.
Pretty
Multi-line, human-readable text format with ANSI colors.
Json
Line-delimited JSON. Required for log aggregators (Vector, Promtail, Datadog Agent, Fluent Bit).
Implementations§
Source§impl Format
impl Format
Sourcepub fn from_env_value(value: &str) -> Result<Self, ParseFormatError>
pub fn from_env_value(value: &str) -> Result<Self, ParseFormatError>
Parse an env-var value.
§Errors
Returns ParseFormatError instead of silently selecting Self::Auto
when the value is unknown.