pub struct LogEntry {
pub level: LogLevel,
pub message: String,
pub timestamp: u64,
pub request_id: Option<String>,
pub trace_id: Option<String>,
pub fields: HashMap<String, LogValue>,
pub file: Option<String>,
pub line: Option<u32>,
}Expand description
A structured log entry
Fields§
§level: LogLevelLog level
message: StringLog message
timestamp: u64Timestamp (Unix milliseconds)
request_id: Option<String>Request ID for correlation
trace_id: Option<String>Trace ID for distributed tracing
fields: HashMap<String, LogValue>Additional fields
file: Option<String>Source file
line: Option<u32>Source line
Implementations§
Source§impl LogEntry
impl LogEntry
Sourcepub fn with_request_id(self, request_id: impl Into<String>) -> Self
pub fn with_request_id(self, request_id: impl Into<String>) -> Self
Set request ID
Sourcepub fn with_trace_id(self, trace_id: impl Into<String>) -> Self
pub fn with_trace_id(self, trace_id: impl Into<String>) -> Self
Set trace ID
Sourcepub fn with_field(
self,
key: impl Into<String>,
value: impl Into<LogValue>,
) -> Self
pub fn with_field( self, key: impl Into<String>, value: impl Into<LogValue>, ) -> Self
Add a field
Sourcepub fn with_location(self, file: impl Into<String>, line: u32) -> Self
pub fn with_location(self, file: impl Into<String>, line: u32) -> Self
Set source location
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 UnsafeUnpin 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