pub struct Log {
pub session_id: u64,
pub time: Cow<'static, str>,
pub level: LogLevel,
pub component: Cow<'static, str>,
pub description: String,
pub format: LogFormat,
pub attributes: BTreeMap<String, Value>,
}Expand description
A structured log entry with a chainable builder API.
Fields use Cow<'static, str> and u64 where possible to
minimize heap allocations on the ingestion hot path.
Construct via level shortcuts (Log::info, Log::error, …)
or the generic Log::build. Dispatch with Log::fire.
Fields§
§session_id: u64Monotonic counter assigned at build() time.
time: Cow<'static, str>Wall-clock timestamp. Populated at build time; override with .time().
level: LogLevelSeverity level (INFO, ERROR, etc.).
component: Cow<'static, str>Originating service or module name. Defaults to "default".
description: StringHuman-readable message body.
format: LogFormatOutput format applied during Display serialization.
attributes: BTreeMap<String, Value>Arbitrary key-value attributes for structured context.
Implementations§
Source§impl Log
impl Log
Sourcepub fn log(&self)
pub fn log(&self)
Ingest this entry into the engine by cloning it.
Prefer fire(), which consumes self and avoids
the clone. Use log() only when you need to retain the entry.
Sourcepub fn build(level: LogLevel, description: &str) -> Self
pub fn build(level: LogLevel, description: &str) -> Self
Build a log entry with an explicit level and description.
Assigns a monotonic session_id and captures the current wall-clock
time. Defaults to LogFormat::MCP and component "default".
Sourcepub const fn session_id(self, session_id: u64) -> Self
pub const fn session_id(self, session_id: u64) -> Self
Override the auto-assigned session ID.