pub struct FmtWrite { /* private fields */ }Expand description
A specialized factory for creating loggers that write to memory-oriented destinations.
The FmtFactory acts as the entry point for any output that implements std::fmt::Write.
It allows you to configure global retry and threading policies before selecting a
specific output target (like a String writer).
§Default Configuration
- Max Retries: 3 (Attempts to re-send if a write failure occurs).
- Worker Count: 1 (Single background thread to maintain message order).
Implementations§
Source§impl FmtWrite
impl FmtWrite
Sourcepub fn string(self) -> StringFmt
pub fn string(self) -> StringFmt
Specializes the factory to log directly to a String.
This is the most direct path for string logging. Each log entry is appended directly into an string.
Sourcepub fn string_with_capacity(self, capacity: usize) -> StringFmt
pub fn string_with_capacity(self, capacity: usize) -> StringFmt
Specializes the factory to log directly to a String.
Allows to set a custom capacity.
This is the most direct path for string logging. Each log entry is appended directly into an string.
Sourcepub fn string_sullied(self, writer: String) -> StringFmt
pub fn string_sullied(self, writer: String) -> StringFmt
Specializes the factory to log directly to a String.
Allows to set an already existing string as the destiny.
This is the most direct path for string logging. Each log entry is appended directly into an string.
Sourcepub fn writer<W>(self, writer: W) -> TypedFmtWrite<W>
pub fn writer<W>(self, writer: W) -> TypedFmtWrite<W>
Specializes the factory for any generic type implementing std::fmt::Write.
Sourcepub fn boxed(self, writer: Box<dyn Write + Send + Sync>) -> BoxedFmtWrite
pub fn boxed(self, writer: Box<dyn Write + Send + Sync>) -> BoxedFmtWrite
Specializes the factory for any generic type implementing Box<dyn std::fmt::Write + Send + Sync>.
Sourcepub fn max_retries(self, max_retries: usize) -> Self
pub fn max_retries(self, max_retries: usize) -> Self
Configures the maximum number of retries for the resulting service.
Sourcepub fn worker_count(self, worker_count: usize) -> Self
pub fn worker_count(self, worker_count: usize) -> Self
Configures the background worker thread count for asynchronous logging.
Sourcepub fn build<W>(self, concurrency: Concurrency, writer: W) -> Logger
pub fn build<W>(self, concurrency: Concurrency, writer: W) -> Logger
Finalizes the logger using a specific writer and a Concurrency strategy.
This uses the default StandardWriteMessageFormatter.
Sourcepub fn build_impl_direct<W>(self, writer: W) -> Box<DirectLogger>
pub fn build_impl_direct<W>(self, writer: W) -> Box<DirectLogger>
Builds a DirectLogger implementation wrapped in a Box.
Sourcepub fn build_impl_queued<W>(self, writer: W) -> Box<QueuedLogger>
pub fn build_impl_queued<W>(self, writer: W) -> Box<QueuedLogger>
Builds a QueuedLogger implementation wrapped in a Box.
Sourcepub fn build_service<W>(
self,
writer: W,
) -> Box<FmtWrite<W, StandardWriteMessageFormatter>>
pub fn build_service<W>( self, writer: W, ) -> Box<FmtWrite<W, StandardWriteMessageFormatter>>
Internal helper to construct the service::FmtWrite service with the standard formatter.
Sourcepub fn build_with_formatter<W, MF>(
self,
concurrency: Concurrency,
writer: W,
formatter: MF,
) -> Logger
pub fn build_with_formatter<W, MF>( self, concurrency: Concurrency, writer: W, formatter: MF, ) -> Logger
Finalizes the logger using a custom formatter and a Concurrency strategy.
Sourcepub fn build_impl_direct_with_formatter<W, MF>(
self,
writer: W,
formatter: MF,
) -> Box<DirectLogger>
pub fn build_impl_direct_with_formatter<W, MF>( self, writer: W, formatter: MF, ) -> Box<DirectLogger>
Builds a DirectLogger with a custom formatter.
Sourcepub fn build_impl_queued_with_formatter<W, MF>(
self,
writer: W,
formatter: MF,
) -> Box<QueuedLogger>
pub fn build_impl_queued_with_formatter<W, MF>( self, writer: W, formatter: MF, ) -> Box<QueuedLogger>
Builds a QueuedLogger with a custom formatter.
Sourcepub fn build_service_with_formatter<W, MF>(
self,
writer: W,
formatter: MF,
) -> Box<FmtWrite<W, MF>>
pub fn build_service_with_formatter<W, MF>( self, writer: W, formatter: MF, ) -> Box<FmtWrite<W, MF>>
Internal helper to construct the service::FmtWrite service with a custom formatter.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FmtWrite
impl RefUnwindSafe for FmtWrite
impl Send for FmtWrite
impl Sync for FmtWrite
impl Unpin for FmtWrite
impl UnwindSafe for FmtWrite
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