Skip to main content

Module request_log

Module request_log 

Source
Expand description

In-memory ring buffer of recent HTTP requests.

LogLayer middleware records each completed request. The global RequestLog holds the most recent N entries (default 1000). MCP tools recent_requests and recent_errors read from it.

§Example

use rust_web_server::app::App;
use rust_web_server::core::New;
use rust_web_server::request_log::{self, LogLayer};

let app = App::new().wrap(LogLayer);

let entries = request_log::global().recent(20);

Structs§

LogEntry
A single recorded request.
LogLayer
Middleware that records each request into the global RequestLog.
RequestLog
Ring buffer of recent requests, sharded by thread; entries carry a global sequence number so readers can merge the shards in order. Each shard keeps up to capacity entries and readers keep the newest capacity overall — exactly what one ring buffer held, since the newest capacity entries overall are always among the newest capacity of their own shard.

Functions§

global
Return the process-wide RequestLog singleton (capacity 1000).