]> git.proxmox.com Git - rustc.git/blame - vendor/tracing-subscriber/tests/registry_with_subscriber.rs
New upstream version 1.65.0+dfsg1
[rustc.git] / vendor / tracing-subscriber / tests / registry_with_subscriber.rs
CommitLineData
c295e0f8 1#![cfg(feature = "registry")]
3dfed10e
XL
2use tracing_futures::{Instrument, WithSubscriber};
3use tracing_subscriber::prelude::*;
4
5#[tokio::test]
6async fn future_with_subscriber() {
064997fb 7 tracing_subscriber::registry().init();
3dfed10e
XL
8 let span = tracing::info_span!("foo");
9 let _e = span.enter();
10 let span = tracing::info_span!("bar");
11 let _e = span.enter();
12 tokio::spawn(
13 async {
14 async {
15 let span = tracing::Span::current();
16 println!("{:?}", span);
17 }
18 .instrument(tracing::info_span!("hi"))
19 .await
20 }
21 .with_subscriber(tracing_subscriber::registry()),
22 )
23 .await
24 .unwrap();
25}