pub struct JsonMessageImpl { /* private fields */ }Expand description
A message implementation that stores structured JSON data.
This is used when you want to pass raw data to a logger that supports structured output (like a database or an ELK stack).
§Feature Requirement
Only available when the json feature is enabled.
Implementations§
Trait Implementations§
Source§impl MessageImpl for JsonMessageImpl
Available on crate feature json only.
impl MessageImpl for JsonMessageImpl
Available on crate feature
json only.Source§fn level(&self) -> &dyn Display
fn level(&self) -> &dyn Display
Returns the log level (e.g., “INFO”, “DEBUG”) as a displayable object.
Using
&dyn Display ensures zero-copy for static string levels.Source§fn content(&self) -> &dyn Display
fn content(&self) -> &dyn Display
Returns the message body content.
This allows for deferred formatting of complex types like JSON or Error objects.
Source§fn instant(&self) -> SystemTime
fn instant(&self) -> SystemTime
Returns the exact SystemTime when the message was created.
Crucial for maintaining chronological order in asynchronous logging.
Auto Trait Implementations§
impl Freeze for JsonMessageImpl
impl RefUnwindSafe for JsonMessageImpl
impl Send for JsonMessageImpl
impl Sync for JsonMessageImpl
impl Unpin for JsonMessageImpl
impl UnwindSafe for JsonMessageImpl
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreCreates a shared type from an unshared type.