Skip to main content

log_max_level

Function log_max_level 

Source
pub fn log_max_level(level: &str) -> LevelFilter
Expand description

The ceiling for the log crate, derived from the configured level.

A log macro evaluates its arguments whenever log::max_level() admits the record, and pingora logs raw upstream response headers with trace!("Raw Response header: {:?}", str::from_utf8(..).unwrap()). Left at Trace - which is what a bare LogTracer::init() does, deferring all filtering to the tracing subscriber - that unwrap runs on every upstream response and panics the proxy worker on the first header carrying non-UTF-8 bytes (CLOUDPUB-1507). Capping the log crate at the level the operator actually configured keeps those arguments unevaluated, and saves the formatting work besides.

Parsed the way the tracing EnvFilter built from the same string parses it - case-insensitively, whitespace trimmed - so the ceiling never lands below the configured level and drops records the operator asked for. Anything unparseable falls back to Info: the fallback must not be the one value that reinstates the panic.