pub struct TypedIoWrite<W>{ /* private fields */ }Expand description
A concrete builder state for a specific writer type W.
Once a writer is provided (via IoWrite::file, IoWrite::buffered_file, etc.),
this struct allows you to finalize the logger by choosing a Concurrency model.
Implementations§
Source§impl<W> TypedIoWrite<W>
impl<W> TypedIoWrite<W>
Sourcepub fn new(writer: W) -> Self
pub fn new(writer: W) -> Self
Creates a new TypedIoWrite with a specific writer and default policies.
Defaults to 3 retries and 1 worker thread.
Sourcepub fn get_writer(&self) -> &W
pub fn get_writer(&self) -> &W
Returns a reference to the underlying writer.
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 writer(self, writer: W) -> Self
pub fn writer(self, writer: W) -> Self
Replaces the current writer while keeping existing retry and worker configurations.
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 this specific writer.
Sourcepub fn worker_count(self, worker_count: usize) -> Self
pub fn worker_count(self, worker_count: usize) -> Self
Updates the background worker count for this specific writer.
Sourcepub fn build(self, concurrency: Concurrency) -> Logger
pub fn build(self, concurrency: Concurrency) -> Logger
Finalizes the builder and returns a high-level Logger.
This uses the default StandardWriteMessageFormatter.
Sourcepub fn build_impl_direct(self) -> Box<DirectLogger>
pub fn build_impl_direct(self) -> Box<DirectLogger>
Builds the underlying DirectLogger implementation for this writer.
Useful if you need to bypass the Logger wrapper and manage the
synchronous driver manually.
Sourcepub fn build_impl_queued(self) -> Box<QueuedLogger>
pub fn build_impl_queued(self) -> Box<QueuedLogger>
Builds the underlying QueuedLogger implementation for this writer.
Useful if you need to bypass the Logger wrapper and manage the
asynchronous worker pool manually.
Sourcepub fn build_service(self) -> Box<IoWrite<W, StandardWriteMessageFormatter>>
pub fn build_service(self) -> Box<IoWrite<W, StandardWriteMessageFormatter>>
Internal helper to construct the service::IoWrite service for this specific writer
using the standard formatter.
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 builder using a custom WriteMessageFormatter.
This allows you to define exactly how messages are serialized (e.g., JSON, custom text headers) before being sent to the writer.
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 for this writer.
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 for this writer.
Sourcepub fn build_service_with_formatter<MF>(
self,
formatter: MF,
) -> Box<IoWrite<W, MF>>where
MF: WriteMessageFormatter + 'static,
pub fn build_service_with_formatter<MF>(
self,
formatter: MF,
) -> Box<IoWrite<W, MF>>where
MF: WriteMessageFormatter + 'static,
Internal helper to construct the service::IoWrite service for this specific writer
using a custom formatter.
Auto Trait Implementations§
impl<W> Freeze for TypedIoWrite<W>where
W: Freeze,
impl<W> RefUnwindSafe for TypedIoWrite<W>where
W: RefUnwindSafe,
impl<W> Send for TypedIoWrite<W>
impl<W> Sync for TypedIoWrite<W>
impl<W> Unpin for TypedIoWrite<W>where
W: Unpin,
impl<W> UnwindSafe for TypedIoWrite<W>where
W: UnwindSafe,
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