🛈 Note: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem.

For the release documentation, please see docs.rs, instead.

tracing_appender

Function non_blocking

Source
pub fn non_blocking<T: Write + Send + 'static>(
    writer: T,
) -> (NonBlocking, WorkerGuard)
Expand description

Convenience function for creating a non-blocking, off-thread writer.

See the non_blocking module’s docs’s for more details.

§Examples

let (non_blocking, _guard) = tracing_appender::non_blocking(std::io::stdout());
let subscriber = tracing_subscriber::fmt().with_writer(non_blocking);
tracing::collect::with_default(subscriber.finish(), || {
   tracing::event!(tracing::Level::INFO, "Hello");
});