Function tracing_appender::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::subscriber::with_default(subscriber.finish(), || {
tracing::event!(tracing::Level::INFO, "Hello");
});