[−][src]Struct tracing_appender::non_blocking::NonBlocking
A non-blocking writer.
While the line between "blocking" and "non-blocking" IO is fuzzy, writing to a file is typically
considered to be a blocking operation. For an application whose Subscriber
writes spans and events
as they are emitted, an application might find the latency profile to be unacceptable.
NonBlocking
moves the writing out of an application's data path by sending spans and events
to a dedicated logging thread.
This struct implements MakeWriter
from the tracing-subscriber
crate. Therefore, it can be used with the tracing_subscriber::fmt
module
or with any other subscriber/layer implementation that uses the MakeWriter
trait.
Methods
impl NonBlocking
[src]
pub fn new<T: Write + Send + Sync + 'static>(
writer: T
) -> (NonBlocking, WorkerGuard)
[src]
writer: T
) -> (NonBlocking, WorkerGuard)
Returns a new NonBlocking
writer wrapping the provided writer
.
The returned NonBlocking
writer will have the default configuration values.
Other configurations can be specified using the builder interface.
pub fn error_counter(&self) -> Arc<AtomicU64>
[src]
Returns a counter for the number of times logs where dropped. This will always return zero if
NonBlocking
is not lossy.
Trait Implementations
impl Clone for NonBlocking
[src]
fn clone(&self) -> NonBlocking
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for NonBlocking
[src]
impl MakeWriter for NonBlocking
[src]
type Writer = NonBlocking
The concrete [io::Write
] implementation returned by [make_writer
]. Read more
fn make_writer(&self) -> Self::Writer
[src]
impl Write for NonBlocking
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
fn flush(&mut self) -> Result<()>
[src]
fn write_all(&mut self, buf: &[u8]) -> Result<()>
[src]
fn write_vectored(&mut self, bufs: &[IoSlice]) -> Result<usize, Error>
1.36.0[src]
fn is_write_vectored(&self) -> bool
[src]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice]) -> Result<(), Error>
[src]
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for NonBlocking
impl Send for NonBlocking
impl Sync for NonBlocking
impl Unpin for NonBlocking
impl UnwindSafe for NonBlocking
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<F, W> MakeWriter for F where
F: Fn() -> W,
W: Write,
[src]
F: Fn() -> W,
W: Write,
type Writer = W
The concrete [io::Write
] implementation returned by [make_writer
]. Read more
fn make_writer(&self) -> <F as MakeWriter>::Writer
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,