File tree Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -86,24 +86,11 @@ others.
8686## using it
8787
8888to ** instrument an application using Tokio** , add a dependency on the
89- [ ` console-subscriber ` ] crate, and ** add the ` TasksLayer ` type** to your
90- [ ` tracing ` ] subscriber. for example:
89+ [ ` console-subscriber ` ] crate, and ** add this one-liner** to the top of your
90+ ` main ` function:
91+
9192``` rust
92- use tracing_subscriber :: {prelude :: * , fmt, EnvFilter };
93- // construct the `console_subscriber` layer and the console wire protocol server
94- let (layer , server ) = console_subscriber :: TasksLayer :: new ();
95- // ensure that Tokio's internal instrumentation is enabled
96- let filter = EnvFilter :: from_default_env (). add_directive (" tokio=trace" . parse ()? );
97-
98- tracing_subscriber :: registry ()
99- // the `TasksLayer` can be used in combination with other `tracing` layers...
100- . with (tracing_subscriber :: fmt :: layer ())
101- . with (filter )
102- . with (layer )
103- . init ();
104-
105- // spawn the server task
106- tokio :: spawn (server . serve ());
93+ console_subscriber :: init ();
10794```
10895
10996notes:
You can’t perform that action at this time.
0 commit comments