pub struct LogEntry {
pub level: LogLevel,
pub message: String,
pub request_id: u64,
pub region_id: String,
pub task_id: String,
pub target: Option<String>,
pub fields: Vec<(String, String)>,
pub timestamp_ns: u64,
}Expand description
A structured log entry with context.
Logs are created via macros that auto-inject request context, then emitted through the configured log sink.
Fields§
§level: LogLevelThe log level.
message: StringThe log message.
request_id: u64Unique request identifier.
region_id: Stringasupersync region ID (formatted as string for serialization).
task_id: Stringasupersync task ID (formatted as string for serialization).
target: Option<String>Module/target path (optional).
fields: Vec<(String, String)>Structured key-value fields (max 16).
timestamp_ns: u64Nanosecond timestamp from asupersync’s virtual time.
Implementations§
Source§impl LogEntry
impl LogEntry
Sourcepub fn new(
ctx: &RequestContext,
level: LogLevel,
message: impl Into<String>,
) -> Self
pub fn new( ctx: &RequestContext, level: LogLevel, message: impl Into<String>, ) -> Self
Creates a new log entry with context from RequestContext.
Sourcepub fn field(self, key: impl Into<String>, value: impl Display) -> Self
pub fn field(self, key: impl Into<String>, value: impl Display) -> Self
Adds a structured field.
Fields beyond the max (16) are silently dropped.
Sourcepub fn to_compact(&self) -> String
pub fn to_compact(&self) -> String
Formats the log entry in compact format.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LogEntry
impl RefUnwindSafe for LogEntry
impl Send for LogEntry
impl Sync for LogEntry
impl Unpin for LogEntry
impl UnwindSafe for LogEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).