Skip to main content

RequestLog

Trait RequestLog 

Source
pub trait RequestLog: Send + Sync {
    // Required method
    fn emit(&self, record: &Value);

    // Provided method
    fn enabled(&self) -> bool { ... }
}
Expand description

Receives one structured record per handled request.

Implementations MUST NOT panic. emit is called inline after the response is produced, so it must be cheap (a line write); heavy delivery belongs behind a background sink.

Required Methods§

Source

fn emit(&self, record: &Value)

Emits one request record (the shape-only explain document).

Provided Methods§

Source

fn enabled(&self) -> bool

Whether this logger will emit. The handler checks this before assembling the record, so a disabled logger costs only this call.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§