pub struct LogLineWrapper { /* private fields */ }
Expand description
A wrapper around a log line that provides formatted and cached representations.
This struct contains a log line and provides various formatted versions of it, such as plain string, colored string, and JSON. It also caches the results for repeated calls, optimizing performance when the same message needs to be logged multiple times in different formats.
Implementations§
Source§impl LogLineWrapper
impl LogLineWrapper
Sourcepub fn new(line: LogLine, trader_id: Ustr, timestamp: UnixNanos) -> Self
pub fn new(line: LogLine, trader_id: Ustr, timestamp: UnixNanos) -> Self
Creates a new LogLineWrapper
instance.
Sourcepub fn get_string(&mut self) -> &str
pub fn get_string(&mut self) -> &str
Returns the plain log message string, caching the result.
This method constructs the log line format and caches it for repeated calls. Useful when the same log message needs to be printed multiple times.
Sourcepub fn get_colored(&mut self) -> &str
pub fn get_colored(&mut self) -> &str
Returns the colored log message string, caching the result.
This method constructs the colored log line format and caches the result for repeated calls, providing the message with ANSI color codes if the logger is configured to use colors.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LogLineWrapper
impl RefUnwindSafe for LogLineWrapper
impl Send for LogLineWrapper
impl Sync for LogLineWrapper
impl Unpin for LogLineWrapper
impl UnwindSafe for LogLineWrapper
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
§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>
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>
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