pub struct Logger {
pub config: LoggerConfig,
/* private fields */
}
Expand description
A high-performance logger utilizing a MPSC channel under the hood.
A logger is initialized with a LoggerConfig
to set up different logging levels for
stdout, file, and components. The logger spawns a thread that listens for LogEvent
s
sent via an MPSC channel.
Fields§
§config: LoggerConfig
Configuration for logging levels and behavior.
Implementations§
Source§impl Logger
impl Logger
pub fn init_with_env( trader_id: TraderId, instance_id: UUID4, file_config: FileWriterConfig, ) -> LogGuard
Sourcepub fn init_with_config(
trader_id: TraderId,
instance_id: UUID4,
config: LoggerConfig,
file_config: FileWriterConfig,
) -> LogGuard
pub fn init_with_config( trader_id: TraderId, instance_id: UUID4, config: LoggerConfig, file_config: FileWriterConfig, ) -> LogGuard
Initializes the logger with the given configuration.
§Examples
let config = LoggerConfig::from_spec("stdout=Info;fileout=Debug;RiskEngine=Error");
let file_config = FileWriterConfig::default();
let log_guard = Logger::init_with_config(trader_id, instance_id, config, file_config);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Logger
impl RefUnwindSafe for Logger
impl Send for Logger
impl Sync for Logger
impl Unpin for Logger
impl UnwindSafe for Logger
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 more