pub struct CoutWrite { /* private fields */ }Expand description
A factory for creating loggers that write directly to the standard output (stdout).
CoutWrite provides a high-level builder for console logging. It is the most
common choice for CLI applications and containerized environments (like Docker or K8s)
where logs are expected to be captured from the process’s stdout stream.
§Default Configuration
- Max Retries:
3(Standard resilience against transient I/O pressure). - Worker Count:
1(Ensures logs appear in chronological order).
Implementations§
Source§impl CoutWrite
impl CoutWrite
Sourcepub fn get_max_retries(&self) -> usize
pub fn get_max_retries(&self) -> usize
Returns the currently configured maximum retry attempts.
Sourcepub fn get_worker_count(&self) -> usize
pub fn get_worker_count(&self) -> usize
Returns the currently configured background worker count.
Sourcepub fn max_retries(self, max_retries: usize) -> Self
pub fn max_retries(self, max_retries: usize) -> Self
Updates the maximum number of retry attempts for the console service.
This is useful if the terminal or pipe is under heavy load and requires multiple attempts to flush data.
Sourcepub fn worker_count(self, worker_count: usize) -> Self
pub fn worker_count(self, worker_count: usize) -> Self
Updates the background worker count for asynchronous console logging.
Note: Using a worker count of 1 is highly recommended for console output to prevent log lines from overlapping or appearing out of order.
Sourcepub fn build(self, concurrency: Concurrency) -> Logger
pub fn build(self, concurrency: Concurrency) -> Logger
Finalizes the logger using the StandardWriteMessageFormatter and a Concurrency strategy.
Sourcepub fn build_with_formatter<MF>(
self,
concurrency: Concurrency,
formatter: MF,
) -> Loggerwhere
MF: WriteMessageFormatter + 'static,
pub fn build_with_formatter<MF>(
self,
concurrency: Concurrency,
formatter: MF,
) -> Loggerwhere
MF: WriteMessageFormatter + 'static,
Finalizes the logger using a custom WriteMessageFormatter and a Concurrency strategy.
Use this to apply custom styling, colors, or structured formats (like JSON) to the console output.
Sourcepub fn build_impl_direct(self) -> Box<DirectLogger>
pub fn build_impl_direct(self) -> Box<DirectLogger>
Builds the underlying DirectLogger implementation for stdout.
Sourcepub fn build_impl_queued(self) -> Box<QueuedLogger>
pub fn build_impl_queued(self) -> Box<QueuedLogger>
Builds the underlying QueuedLogger implementation for stdout.
Sourcepub fn build_impl_direct_with_formatter<MF>(
self,
formatter: MF,
) -> Box<DirectLogger>where
MF: WriteMessageFormatter + 'static,
pub fn build_impl_direct_with_formatter<MF>(
self,
formatter: MF,
) -> Box<DirectLogger>where
MF: WriteMessageFormatter + 'static,
Builds a DirectLogger with a specific formatter.
Sourcepub fn build_impl_queued_with_formatter<MF>(
self,
formatter: MF,
) -> Box<QueuedLogger>where
MF: WriteMessageFormatter + 'static,
pub fn build_impl_queued_with_formatter<MF>(
self,
formatter: MF,
) -> Box<QueuedLogger>where
MF: WriteMessageFormatter + 'static,
Builds a QueuedLogger with a specific formatter.
Sourcepub fn build_service_with_formatter<MF>(
self,
formatter: MF,
) -> Box<CoutWrite<MF>>where
MF: WriteMessageFormatter + 'static,
pub fn build_service_with_formatter<MF>(
self,
formatter: MF,
) -> Box<CoutWrite<MF>>where
MF: WriteMessageFormatter + 'static,
Internal helper to construct the service::CoutWrite service with a custom formatter.
Sourcepub fn build_service(self) -> Box<CoutWrite<StandardWriteMessageFormatter>>
pub fn build_service(self) -> Box<CoutWrite<StandardWriteMessageFormatter>>
Internal helper to construct the service::CoutWrite service with the standard formatter.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CoutWrite
impl RefUnwindSafe for CoutWrite
impl Send for CoutWrite
impl Sync for CoutWrite
impl Unpin for CoutWrite
impl UnwindSafe for CoutWrite
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