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.
86
86
## using it
87
87
88
88
to ** 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
+
91
92
``` 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 ();
107
94
```
108
95
109
96
notes:
You can’t perform that action at this time.
0 commit comments