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 const fn new(line: LogLine, trader_id: Ustr) -> Self
pub const fn new(line: LogLine, trader_id: Ustr) -> 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.