pub struct WideEvent<K: Key> { /* private fields */ }Expand description
A wide event — a structured log record that accumulates fields throughout a request/task lifecycle and is emitted as a single JSON line on completion.
Fields are stored in an array indexed by K::as_index() — O(1) lookup
with no linear scan. Up to INLINE_CAP (24) Option<Value> slots are
inline on the stack; zero heap allocation in the common case. Log entries
are stored in a separate SmallVec with inline capacity of 16.
The Serialize impl emits all user entries in enum-variant order, then
the "log" key (if any log entries have been accumulated). The "log"
key is never declared by the user — it appears automatically.
This type is not constructed directly by users. The wide_log! macro
generates a WideLogGuard that owns a WideEvent and manages the
thread-local/task-local pointer via current().
Implementations§
Source§impl<K: Key> WideEvent<K>
impl<K: Key> WideEvent<K>
Sourcepub fn add_path<V: Into<Value<K>>>(&mut self, path: &[K], value: V)
pub fn add_path<V: Into<Value<K>>>(&mut self, path: &[K], value: V)
Set a value at a nested path. Traverses/creates intermediate objects.
pub fn inc_path(&mut self, path: &[K])
pub fn dec_path(&mut self, path: &[K])
pub fn add_n_path(&mut self, path: &[K], n: i64)
pub fn append_log_entry(&mut self, level: &'static str, message: &str)
Sourcepub fn append_log_entry_static(
&mut self,
level: &'static str,
message: &'static str,
)
pub fn append_log_entry_static( &mut self, level: &'static str, message: &'static str, )
Append a log entry with a &'static str message — zero-copy.