Skip to main content

Module log

Module log 

Source
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 prefix

Structs§

CloudilloFormat
Custom event formatter. Writes each line as <timestamp> <LEVEL> [REQ:<id> ]<fields>\n and delegates field formatting to the inner FormatFields.
RequestShortId
Captured id field of a request span. Stored in the span’s extensions by RequestSpanLayer at span creation time and read by CloudilloFormat at event format time.
RequestSpanLayer
tracing Layer that snapshots the id field of request spans 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 (in extract.rs) produces spans with this exact name.