pub struct StandardMessageFormatter {}Expand description
A high-performance, stateful formatter that produces RFC 3339 compliant logs.
§Output Format
The formatter produces a single line per message using the following pattern:
[Timestamp] [ [Level] ] [Message]
- Timestamp: Generated in UTC using RFC 3339
format with nanosecond precision (e.g.,
2026-03-14T14:48:02.609225083+00:00). - Level: The log level is uppercase, padded with single spaces inside brackets
(e.g.,
[ DEBUG ],[ INFO ],[ ERROR ]). - Message: The raw message content followed by a newline (
\n).
§Example Output
2026-03-14T15:30:00.123456789+00:00 [ INFO ] Service started successfully
2026-03-14T15:30:05.000000000+00:00 [ DEBUG ] Connecting to Loki at localhost:3100Implementations§
Trait Implementations§
Source§impl Default for StandardMessageFormatter
impl Default for StandardMessageFormatter
Source§fn default() -> StandardMessageFormatter
fn default() -> StandardMessageFormatter
Returns the “default value” for a type. Read more
Source§impl MessageFormatter for StandardMessageFormatter
impl MessageFormatter for StandardMessageFormatter
Source§fn format_io(
&mut self,
message: &Message,
write: &mut (dyn Write + Send + Sync),
) -> Result<(), ServiceError>
fn format_io( &mut self, message: &Message, write: &mut (dyn Write + Send + Sync), ) -> Result<(), ServiceError>
Formats and writes the message to the provided I/O sink. Read more
Source§fn format_fmt(
&mut self,
message: &Message,
write: &mut (dyn Write + Send + Sync),
) -> Result<(), ServiceError>
fn format_fmt( &mut self, message: &Message, write: &mut (dyn Write + Send + Sync), ) -> Result<(), ServiceError>
Formats a message specifically for fmt-based destinations.
Auto Trait Implementations§
impl Freeze for StandardMessageFormatter
impl RefUnwindSafe for StandardMessageFormatter
impl Send for StandardMessageFormatter
impl Sync for StandardMessageFormatter
impl Unpin for StandardMessageFormatter
impl UnwindSafe for StandardMessageFormatter
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.