Expand description
Custom tracing event formatter and request-id capture layer.
CloudilloFormat prefixes each event line with REQ:<short> when the
current span scope contains a request span (created by
RequestId::install in extract.rs). When no request span is in scope
(background tasks, startup, scheduler ticks), no prefix is added.
RequestSpanLayer captures the id field of every newly created
request span into the span’s extensions as a RequestShortId. The
formatter then reads that value with no string parsing or ANSI stripping.
The request span is created at Level::ERROR, so it remains in scope
even when the global filter is set to warn or error.
Output shape:
2026-05-05T12:00:00.123Z INFO REQ:a1b2 message body
2026-05-05T12:00:00.456Z INFO startup line without REQ prefixStructs§
- Cloudillo
Format - Custom event formatter. Writes each line as
<timestamp> <LEVEL> [REQ:<id> ]<fields>\nand delegates field formatting to the innerFormatFields. - Request
Short Id - Captured
idfield of arequestspan. Stored in the span’s extensions byRequestSpanLayerat span creation time and read byCloudilloFormatat event format time. - Request
Span Layer tracingLayer that snapshots theidfield ofrequestspans into the span’s extensions, so the formatter does not need to re-parse the pre-formatted span fields string.
Constants§
- REQUEST_
SPAN_ NAME - Span name matched by the formatter and the layer — the public constant
RequestId::install(inextract.rs) produces spans with this exact name.