pub struct BoxedFmtWrite { /* private fields */ }Expand description
A concrete builder state for a specific boxed writer type W.
Once a writer is provided (via FmtWrite::boxed, etc.),
this struct allows you to finalize the logger by choosing a Concurrency model.
Implementations§
Source§impl BoxedFmtWrite
impl BoxedFmtWrite
Sourcepub fn new(writer: Box<dyn Write + Send + Sync>) -> Self
pub fn new(writer: Box<dyn Write + Send + Sync>) -> Self
Creates a new TypedFmtWrite with a specific writer and default policies.
Defaults to 3 retries and 1 worker thread.
Sourcepub fn get_writer(&self) -> &(dyn Write + Send + Sync)
pub fn get_writer(&self) -> &(dyn Write + Send + Sync)
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: Box<dyn Write + Send + Sync>) -> Self
pub fn writer(self, writer: Box<dyn Write + Send + Sync>) -> 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<BoxedFmtWrite<StandardWriteMessageFormatter>>
pub fn build_service(self) -> Box<BoxedFmtWrite<StandardWriteMessageFormatter>>
Internal helper to construct the service::BoxedFmtWrite 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<BoxedFmtWrite<MF>>where
MF: WriteMessageFormatter + 'static,
pub fn build_service_with_formatter<MF>(
self,
formatter: MF,
) -> Box<BoxedFmtWrite<MF>>where
MF: WriteMessageFormatter + 'static,
Internal helper to construct the service::BoxedFmtWrite service for this specific writer
using a custom formatter.
Auto Trait Implementations§
impl Freeze for BoxedFmtWrite
impl !RefUnwindSafe for BoxedFmtWrite
impl Send for BoxedFmtWrite
impl Sync for BoxedFmtWrite
impl Unpin for BoxedFmtWrite
impl !UnwindSafe for BoxedFmtWrite
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