pub struct LogEntry {Show 15 fields
pub id: String,
pub timestamp: DateTime<Utc>,
pub level: LogLevel,
pub message: String,
pub component: String,
pub operation: Option<String>,
pub user_id: Option<String>,
pub session_id: Option<String>,
pub trace_id: Option<String>,
pub span_id: Option<String>,
pub fields: HashMap<String, Value>,
pub stack_trace: Option<String>,
pub source_file: Option<String>,
pub source_line: Option<u32>,
pub duration_ms: Option<f64>,
}Expand description
Structured log entry
Fields§
§id: String§timestamp: DateTime<Utc>§level: LogLevel§message: String§component: String§operation: Option<String>§user_id: Option<String>§session_id: Option<String>§trace_id: Option<String>§span_id: Option<String>§fields: HashMap<String, Value>§stack_trace: Option<String>§source_file: Option<String>§source_line: Option<u32>§duration_ms: Option<f64>Implementations§
Source§impl LogEntry
impl LogEntry
pub fn new( level: LogLevel, message: impl Into<String>, component: impl Into<String>, ) -> Self
pub fn with_operation(self, operation: impl Into<String>) -> Self
pub fn with_user(self, user_id: impl Into<String>) -> Self
pub fn with_session(self, session_id: impl Into<String>) -> Self
pub fn with_trace( self, trace_id: impl Into<String>, span_id: impl Into<String>, ) -> Self
pub fn with_field(self, key: impl Into<String>, value: Value) -> Self
pub fn with_duration(self, duration_ms: f64) -> Self
pub fn with_source(self, file: impl Into<String>, line: u32) -> Self
pub fn with_stack_trace(self, stack_trace: impl Into<String>) -> Self
Sourcepub fn to_json(&self) -> RragResult<String>
pub fn to_json(&self) -> RragResult<String>
Format as JSON for structured logging
Trait Implementations§
Source§impl<'de> Deserialize<'de> for LogEntry
impl<'de> Deserialize<'de> for LogEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl RetentionData for LogEntry
impl RetentionData for LogEntry
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