Expand description
Bounded complete records using stock tracing field formatting.
The event envelope matches tracing-subscriber’s default Full format with ANSI disabled by default and optionally enabled by the caller. Non-ANSI fields use the public DefaultFields visitor unchanged. This Layer owns per-call event storage and bounded span caches, avoiding the fmt Layer’s destructible TLS output buffer and unbounded initial span cache. A failed update preserves the previous cache; errors poison later records. A sink accepts one complete record or returns an error and is never retried.
This does not make Registry or EnvFilter teardown-safe: creating/entering spans or using dynamic span filters after their TLS teardown remains subject to those dependencies’ lifetime requirements. A contextual event after Registry TLS destruction can lose its current span without a local error; the public Context API cannot distinguish this from having no entered span. Such emissions must not be treated as complete-log evidence. This module provides neither capture completion nor deterministic record ordering. This preparation is not wired into backend verification.
Structs§
- Formatter
Limits - Formatter payload budgets, not a bound on callback allocations, registry or filter bookkeeping, allocator overhead, live spans or concurrent emitters. Each formatting call reserves its full event or span budget fallibly. Span caches retain that allocation, including unused capacity; an update briefly holds both the old cache and its replacement. An allocator may reserve more than requested, but only the configured payload limit may be written.
- Record
Status - Retain this independently of the subscriber, including through its Drop.
Enums§
- Buffer
Kind - Record
Failure - A sticky failure, not a capture-completion or deterministic-order verdict.
Constants§
- EVENT_
BYTES - Provisional per-event payload budget, not derived from measured workloads. Measure complete INFO record sizes before selecting production limits or wiring this preparation into backend verification.
- SPAN_
BYTES - Provisional per-span payload budget, not derived from measured workloads. Each successfully formatted span retains the full reserved capacity until its cache is replaced or the span closes, even when its fields are short. Measure field sizes and live-span memory costs before production wiring.
Functions§
- record_
layer_ with_ failure - Prepare a complete-record layer without installing it or selecting events.
- record_
layer_ with_ failure_ and_ ansi - Prepare a complete-record layer with an explicit ANSI formatting policy.
- record_
subscriber_ with_ failure - Prepare without installing a subscriber or opening a destination.