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 11//! Console Log Subscriber Settings.
22
3- use tracing:: level_filters:: LevelFilter ;
4-
53use super :: { Build , CommonSettings , Settings , SettingsBuilder } ;
64
75/// Configure specific settings for the Console Log subscriber.
@@ -78,16 +76,8 @@ impl Build<ConsoleLogSettings> for SettingsBuilder {
7876}
7977
8078impl 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
9181 }
9282}
9383
Original file line number Diff line number Diff line change @@ -13,14 +13,23 @@ pub use otlp_trace::*;
1313
1414/// Simplifies access common settings from subscriber specific settings.
1515pub trait CommonSettings {
16+ /// Access to common settings.
17+ fn common ( & self ) -> & Settings ;
18+
1619 /// 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+ }
1823
1924 /// 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+ }
2128
2229 /// Access to the [`Settings::enabled`] field.
23- fn enabled ( & self ) -> bool ;
30+ fn enabled ( & self ) -> bool {
31+ self . common ( ) . enabled
32+ }
2433}
2534
2635/// General settings that apply to any subscriber.
Original file line number Diff line number Diff line change 11//! OTLP Log Subscriber Settings.
22
3- use tracing:: level_filters:: LevelFilter ;
4-
53use super :: { Build , CommonSettings , Settings , SettingsBuilder } ;
64
75#[ derive( Debug , Default , PartialEq ) ]
@@ -43,16 +41,8 @@ impl Build<OtlpLogSettings> for SettingsBuilder {
4341}
4442
4543impl 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
5646 }
5747}
5848
Original file line number Diff line number Diff line change 11//! OTLP Trace Subscriber Settings.
22
3- use tracing:: level_filters:: LevelFilter ;
4-
53use super :: { Build , CommonSettings , Settings , SettingsBuilder } ;
64
75#[ derive( Debug , Default , PartialEq ) ]
@@ -43,16 +41,8 @@ impl Build<OtlpTraceSettings> for SettingsBuilder {
4341}
4442
4543impl 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
5646 }
5747}
5848
You can’t perform that action at this time.
0 commit comments