pub struct StructuredLog {
pub timestamp: String,
pub level: String,
pub message: String,
pub context: Option<Value>,
pub request_id: Option<String>,
pub user_id: Option<String>,
}Expand description
Structured log entry
Fields§
§timestamp: StringTimestamp
level: StringLog level
message: StringMessage
context: Option<Value>Additional context
request_id: Option<String>Request ID (if applicable)
user_id: Option<String>User ID (if applicable)
Implementations§
Source§impl StructuredLog
impl StructuredLog
Sourcepub fn with_context(self, context: Value) -> Self
pub fn with_context(self, context: Value) -> Self
Adds context to the log entry
Sourcepub fn with_request_id(self, request_id: String) -> Self
pub fn with_request_id(self, request_id: String) -> Self
Adds request ID to the log entry
Sourcepub fn with_user_id(self, user_id: String) -> Self
pub fn with_user_id(self, user_id: String) -> Self
Adds user ID to the log entry
Trait Implementations§
Source§impl Clone for StructuredLog
impl Clone for StructuredLog
Source§impl Debug for StructuredLog
impl Debug for StructuredLog
Source§impl<'de> Deserialize<'de> for StructuredLog
impl<'de> Deserialize<'de> for StructuredLog
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
Auto Trait Implementations§
impl Freeze for StructuredLog
impl RefUnwindSafe for StructuredLog
impl Send for StructuredLog
impl Sync for StructuredLog
impl Unpin for StructuredLog
impl UnsafeUnpin for StructuredLog
impl UnwindSafe for StructuredLog
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more