1
- use super :: { Server , TasksLayer } ;
1
+ use super :: { ConsoleLayer , Server } ;
2
2
use std:: {
3
3
net:: { SocketAddr , ToSocketAddrs } ,
4
4
path:: PathBuf ,
@@ -14,7 +14,7 @@ use tracing_subscriber::{
14
14
registry:: LookupSpan ,
15
15
} ;
16
16
17
- /// Builder for configuring [`TasksLayer `]s.
17
+ /// Builder for configuring [`ConsoleLayer `]s.
18
18
#[ derive( Clone , Debug ) ]
19
19
pub struct Builder {
20
20
/// The maximum capacity for the channel of events from the subscriber to
@@ -41,10 +41,10 @@ pub struct Builder {
41
41
impl Default for Builder {
42
42
fn default ( ) -> Self {
43
43
Self {
44
- event_buffer_capacity : TasksLayer :: DEFAULT_EVENT_BUFFER_CAPACITY ,
45
- client_buffer_capacity : TasksLayer :: DEFAULT_CLIENT_BUFFER_CAPACITY ,
46
- publish_interval : TasksLayer :: DEFAULT_PUBLISH_INTERVAL ,
47
- retention : TasksLayer :: DEFAULT_RETENTION ,
44
+ event_buffer_capacity : ConsoleLayer :: DEFAULT_EVENT_BUFFER_CAPACITY ,
45
+ client_buffer_capacity : ConsoleLayer :: DEFAULT_CLIENT_BUFFER_CAPACITY ,
46
+ publish_interval : ConsoleLayer :: DEFAULT_PUBLISH_INTERVAL ,
47
+ retention : ConsoleLayer :: DEFAULT_RETENTION ,
48
48
server_addr : SocketAddr :: new ( Server :: DEFAULT_IP , Server :: DEFAULT_PORT ) ,
49
49
recording_path : None ,
50
50
}
@@ -57,7 +57,7 @@ impl Builder {
57
57
///
58
58
/// When this channel is at capacity, additional events will be dropped.
59
59
///
60
- /// By default, this is [`TasksLayer ::DEFAULT_EVENT_BUFFER_CAPACITY`].
60
+ /// By default, this is [`ConsoleLayer ::DEFAULT_EVENT_BUFFER_CAPACITY`].
61
61
pub fn event_buffer_capacity ( self , event_buffer_capacity : usize ) -> Self {
62
62
Self {
63
63
event_buffer_capacity,
@@ -70,7 +70,7 @@ impl Builder {
70
70
///
71
71
/// When this channel is at capacity, the client may be disconnected.
72
72
///
73
- /// By default, this is [`TasksLayer ::DEFAULT_CLIENT_BUFFER_CAPACITY`].
73
+ /// By default, this is [`ConsoleLayer ::DEFAULT_CLIENT_BUFFER_CAPACITY`].
74
74
pub fn client_buffer_capacity ( self , client_buffer_capacity : usize ) -> Self {
75
75
Self {
76
76
client_buffer_capacity,
@@ -83,7 +83,7 @@ impl Builder {
83
83
/// A shorter duration will allow clients to update more frequently, but may
84
84
/// result in the program spending more time preparing task data updates.
85
85
///
86
- /// By default, this is [`TasksLayer ::DEFAULT_PUBLISH_INTERVAL`].
86
+ /// By default, this is [`ConsoleLayer ::DEFAULT_PUBLISH_INTERVAL`].
87
87
pub fn publish_interval ( self , publish_interval : Duration ) -> Self {
88
88
Self {
89
89
publish_interval,
@@ -98,7 +98,7 @@ impl Builder {
98
98
/// will reduce memory usage, but less historical data from completed tasks
99
99
/// will be retained.
100
100
///
101
- /// By default, this is [`TasksLayer ::DEFAULT_RETENTION`].
101
+ /// By default, this is [`ConsoleLayer ::DEFAULT_RETENTION`].
102
102
pub fn retention ( self , retention : Duration ) -> Self {
103
103
Self { retention, ..self }
104
104
}
@@ -122,9 +122,9 @@ impl Builder {
122
122
}
123
123
}
124
124
125
- /// Completes the builder, returning a [`TasksLayer `] and [`Server`] task.
126
- pub fn build ( self ) -> ( TasksLayer , Server ) {
127
- TasksLayer :: build ( self )
125
+ /// Completes the builder, returning a [`ConsoleLayer `] and [`Server`] task.
126
+ pub fn build ( self ) -> ( ConsoleLayer , Server ) {
127
+ ConsoleLayer :: build ( self )
128
128
}
129
129
130
130
/// Configures this builder from a standard set of environment variables:
@@ -165,7 +165,7 @@ impl Builder {
165
165
/// This function represents the easiest way to get started using
166
166
/// tokio-console.
167
167
///
168
- /// In addition to the [`TasksLayer `], which collects instrumentation data
168
+ /// In addition to the [`ConsoleLayer `], which collects instrumentation data
169
169
/// consumed by the console, the default [`Subscriber`][sub] initialized by this
170
170
/// function also includes a [`tracing_subscriber::fmt`] layer, which logs
171
171
/// tracing spans and events to stdout. Which spans and events are logged will
@@ -207,7 +207,7 @@ impl Builder {
207
207
/// ```rust
208
208
/// use tracing_subscriber::prelude::*;
209
209
///
210
- /// let console_layer = console_subscriber::TasksLayer ::builder().spawn();
210
+ /// let console_layer = console_subscriber::ConsoleLayer ::builder().spawn();
211
211
///
212
212
/// tracing_subscriber::registry()
213
213
/// .with(console_layer)
@@ -237,7 +237,7 @@ impl Builder {
237
237
. init ( ) ;
238
238
}
239
239
240
- /// Returns a new `tracing` [`Layer`] consisting of a [`TasksLayer `]
240
+ /// Returns a new `tracing` [`Layer`] consisting of a [`ConsoleLayer `]
241
241
/// and a [filter] that enables the spans and events required by the console.
242
242
///
243
243
/// This function spawns the console subscriber's [`Server`] in its own Tokio
@@ -276,7 +276,7 @@ impl Builder {
276
276
/// ```rust
277
277
/// use tracing_subscriber::prelude::*;
278
278
///
279
- /// let console_layer = console_subscriber::TasksLayer ::builder()
279
+ /// let console_layer = console_subscriber::ConsoleLayer ::builder()
280
280
/// .with_default_env()
281
281
/// .spawn();
282
282
///
@@ -342,7 +342,7 @@ impl Builder {
342
342
/// This function represents the easiest way to get started using
343
343
/// tokio-console.
344
344
///
345
- /// In addition to the [`TasksLayer `], which collects instrumentation data
345
+ /// In addition to the [`ConsoleLayer `], which collects instrumentation data
346
346
/// consumed by the console, the default [`Subscriber`][sub] initialized by this
347
347
/// function also includes a [`tracing_subscriber::fmt`] layer, which logs
348
348
/// tracing spans and events to stdout. Which spans and events are logged will
@@ -395,16 +395,16 @@ impl Builder {
395
395
///
396
396
/// Calling `console_subscriber::init` is equivalent to the following:
397
397
/// ```rust
398
- /// use console_subscriber::TasksLayer ;
398
+ /// use console_subscriber::ConsoleLayer ;
399
399
///
400
- /// TasksLayer ::builder().with_default_env().init();
400
+ /// ConsoleLayer ::builder().with_default_env().init();
401
401
/// ```
402
402
/// [`Targets`]: https://docs.rs/tracing-subscriber/latest/tracing-subscriber/filter/struct.Targets.html
403
403
pub fn init ( ) {
404
- TasksLayer :: builder ( ) . with_default_env ( ) . init ( ) ;
404
+ ConsoleLayer :: builder ( ) . with_default_env ( ) . init ( ) ;
405
405
}
406
406
407
- /// Returns a new `tracing_subscriber` [`Layer`] configured with a [`TasksLayer `]
407
+ /// Returns a new `tracing_subscriber` [`Layer`] configured with a [`ConsoleLayer `]
408
408
/// and a [filter] that enables the spans and events required by the console.
409
409
///
410
410
/// This function spawns the console subscriber's [`Server`] in its own Tokio
@@ -415,9 +415,9 @@ pub fn init() {
415
415
///
416
416
/// This function is equivalent to the following:
417
417
/// ```
418
- /// use console_subscriber::TasksLayer ;
418
+ /// use console_subscriber::ConsoleLayer ;
419
419
///
420
- /// let layer = TasksLayer ::builder().with_default_env().spawn();
420
+ /// let layer = ConsoleLayer ::builder().with_default_env().spawn();
421
421
/// # use tracing_subscriber::prelude::*;
422
422
/// # tracing_subscriber::registry().with(layer).init(); // to suppress must_use warnings
423
423
/// ```
@@ -466,7 +466,7 @@ pub fn spawn<S>() -> impl Layer<S>
466
466
where
467
467
S : Subscriber + for < ' a > LookupSpan < ' a > ,
468
468
{
469
- TasksLayer :: builder ( ) . with_default_env ( ) . spawn :: < S > ( )
469
+ ConsoleLayer :: builder ( ) . with_default_env ( ) . spawn :: < S > ( )
470
470
}
471
471
472
472
fn duration_from_env ( var_name : & str ) -> Option < Duration > {
0 commit comments