File tree Expand file tree Collapse file tree 4 files changed +18
-39
lines changed
crates/stackable-telemetry/src/tracing/settings Expand file tree Collapse file tree 4 files changed +18
-39
lines changed Original file line number Diff line number Diff line change 1
1
//! Console Log Subscriber Settings.
2
2
3
- use tracing:: level_filters:: LevelFilter ;
4
-
5
3
use super :: { Build , CommonSettings , Settings , SettingsBuilder } ;
6
4
7
5
/// Configure specific settings for the Console Log subscriber.
@@ -78,16 +76,8 @@ impl Build<ConsoleLogSettings> for SettingsBuilder {
78
76
}
79
77
80
78
impl CommonSettings for ConsoleLogSettings {
81
- fn environment_variable ( & self ) -> & ' static str {
82
- self . common_settings . environment_variable
83
- }
84
-
85
- fn default_level ( & self ) -> LevelFilter {
86
- self . common_settings . default_level
87
- }
88
-
89
- fn enabled ( & self ) -> bool {
90
- self . common_settings . enabled
79
+ fn common ( & self ) -> & Settings {
80
+ & self . common_settings
91
81
}
92
82
}
93
83
Original file line number Diff line number Diff line change @@ -13,14 +13,23 @@ pub use otlp_trace::*;
13
13
14
14
/// Simplifies access common settings from subscriber specific settings.
15
15
pub trait CommonSettings {
16
+ /// Access to common settings.
17
+ fn common ( & self ) -> & Settings ;
18
+
16
19
/// Access to the [`Settings::environment_variable`] field.
17
- fn environment_variable ( & self ) -> & ' static str ;
20
+ fn environment_variable ( & self ) -> & ' static str {
21
+ self . common ( ) . environment_variable
22
+ }
18
23
19
24
/// Access to the [`Settings::default_level`] field.
20
- fn default_level ( & self ) -> LevelFilter ;
25
+ fn default_level ( & self ) -> LevelFilter {
26
+ self . common ( ) . default_level
27
+ }
21
28
22
29
/// Access to the [`Settings::enabled`] field.
23
- fn enabled ( & self ) -> bool ;
30
+ fn enabled ( & self ) -> bool {
31
+ self . common ( ) . enabled
32
+ }
24
33
}
25
34
26
35
/// General settings that apply to any subscriber.
Original file line number Diff line number Diff line change 1
1
//! OTLP Log Subscriber Settings.
2
2
3
- use tracing:: level_filters:: LevelFilter ;
4
-
5
3
use super :: { Build , CommonSettings , Settings , SettingsBuilder } ;
6
4
7
5
#[ derive( Debug , Default , PartialEq ) ]
@@ -43,16 +41,8 @@ impl Build<OtlpLogSettings> for SettingsBuilder {
43
41
}
44
42
45
43
impl CommonSettings for OtlpLogSettings {
46
- fn environment_variable ( & self ) -> & ' static str {
47
- self . common_settings . environment_variable
48
- }
49
-
50
- fn default_level ( & self ) -> LevelFilter {
51
- self . common_settings . default_level
52
- }
53
-
54
- fn enabled ( & self ) -> bool {
55
- self . common_settings . enabled
44
+ fn common ( & self ) -> & Settings {
45
+ & self . common_settings
56
46
}
57
47
}
58
48
Original file line number Diff line number Diff line change 1
1
//! OTLP Trace Subscriber Settings.
2
2
3
- use tracing:: level_filters:: LevelFilter ;
4
-
5
3
use super :: { Build , CommonSettings , Settings , SettingsBuilder } ;
6
4
7
5
#[ derive( Debug , Default , PartialEq ) ]
@@ -43,16 +41,8 @@ impl Build<OtlpTraceSettings> for SettingsBuilder {
43
41
}
44
42
45
43
impl CommonSettings for OtlpTraceSettings {
46
- fn environment_variable ( & self ) -> & ' static str {
47
- self . common_settings . environment_variable
48
- }
49
-
50
- fn default_level ( & self ) -> LevelFilter {
51
- self . common_settings . default_level
52
- }
53
-
54
- fn enabled ( & self ) -> bool {
55
- self . common_settings . enabled
44
+ fn common ( & self ) -> & Settings {
45
+ & self . common_settings
56
46
}
57
47
}
58
48
You can’t perform that action at this time.
0 commit comments