pub struct RichLogFormatter { /* private fields */ }Expand description
Formats tracing events into rich, styled output.
The formatter is aware of the display context and will produce plain text output when running in agent mode (machine parsing) vs rich styled output when running in human mode (interactive terminal).
Implementations§
Source§impl RichLogFormatter
impl RichLogFormatter
Sourcepub fn new(theme: &'static FastMcpTheme, context: DisplayContext) -> Self
pub fn new(theme: &'static FastMcpTheme, context: DisplayContext) -> Self
Create a new formatter with the given theme and context.
Sourcepub fn with_target(self, show: bool) -> Self
pub fn with_target(self, show: bool) -> Self
Set whether to show the target/module path.
Sourcepub fn with_timestamp(self, show: bool) -> Self
pub fn with_timestamp(self, show: bool) -> Self
Set whether to show timestamps.
Sourcepub fn with_file_line(self, show: bool) -> Self
pub fn with_file_line(self, show: bool) -> Self
Set whether to show file:line information.
Sourcepub fn with_max_width(self, width: Option<usize>) -> Self
pub fn with_max_width(self, width: Option<usize>) -> Self
Set maximum width for message/target truncation.
Sourcepub fn should_use_rich(&self) -> bool
pub fn should_use_rich(&self) -> bool
Check if rich output should be used.
Sourcepub fn style_for_level(&self, level: LogLevel) -> &Style
pub fn style_for_level(&self, level: LogLevel) -> &Style
Get the style for a given log level.
Sourcepub fn format_level_badge(&self, level: LogLevel) -> String
pub fn format_level_badge(&self, level: LogLevel) -> String
Format a level badge (e.g., [ERROR], [INFO ]).
Sourcepub fn format_timestamp(&self, timestamp: &str) -> Option<String>
pub fn format_timestamp(&self, timestamp: &str) -> Option<String>
Format a timestamp.
Sourcepub fn format_target(&self, target: &str) -> Option<String>
pub fn format_target(&self, target: &str) -> Option<String>
Format a target/module path.
Sourcepub fn format_fields(&self, fields: &[(String, String)]) -> String
pub fn format_fields(&self, fields: &[(String, String)]) -> String
Format structured fields (key=value pairs).
Sourcepub fn format_event(&self, event: &LogEvent) -> FormattedLog
pub fn format_event(&self, event: &LogEvent) -> FormattedLog
Format a complete log event.
Sourcepub fn format_line(&self, event: &LogEvent) -> String
pub fn format_line(&self, event: &LogEvent) -> String
Format a log event to a single line string.
Trait Implementations§
Source§impl Debug for RichLogFormatter
impl Debug for RichLogFormatter
Auto Trait Implementations§
impl Freeze for RichLogFormatter
impl RefUnwindSafe for RichLogFormatter
impl Send for RichLogFormatter
impl Sync for RichLogFormatter
impl Unpin for RichLogFormatter
impl UnsafeUnpin for RichLogFormatter
impl UnwindSafe for RichLogFormatter
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).
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