@@ -23,12 +23,20 @@ macro_rules! otel_info {
23
23
{
24
24
tracing:: info!( name: $name, target: env!( "CARGO_PKG_NAME" ) , "" ) ;
25
25
}
26
+ #[ cfg( not( feature = "internal-logs" ) ) ]
27
+ {
28
+ let _ = $name; // Compiler will optimize this out as it's unused.
29
+ }
26
30
} ;
27
31
( name: $name: expr, $( $key: ident = $value: expr) ,+ $( , ) ?) => {
28
32
#[ cfg( feature = "internal-logs" ) ]
29
33
{
30
34
tracing:: info!( name: $name, target: env!( "CARGO_PKG_NAME" ) , $( $key = $value) ,+, "" ) ;
31
35
}
36
+ #[ cfg( not( feature = "internal-logs" ) ) ]
37
+ {
38
+ let _ = ( $name, $( $value) ,+) ; // Compiler will optimize this out as it's unused.
39
+ }
32
40
} ;
33
41
}
34
42
@@ -50,12 +58,20 @@ macro_rules! otel_warn {
50
58
{
51
59
tracing:: warn!( name: $name, target: env!( "CARGO_PKG_NAME" ) , "" ) ;
52
60
}
61
+ #[ cfg( not( feature = "internal-logs" ) ) ]
62
+ {
63
+ let _ = $name; // Compiler will optimize this out as it's unused.
64
+ }
53
65
} ;
54
66
( name: $name: expr, $( $key: ident = $value: expr) ,+ $( , ) ?) => {
55
67
#[ cfg( feature = "internal-logs" ) ]
56
68
{
57
69
tracing:: warn!( name: $name, target: env!( "CARGO_PKG_NAME" ) , $( $key = $value) ,+, "" ) ;
58
70
}
71
+ #[ cfg( not( feature = "internal-logs" ) ) ]
72
+ {
73
+ let _ = ( $name, $( $value) ,+) ; // Compiler will optimize this out as it's unused.
74
+ }
59
75
} ;
60
76
}
61
77
@@ -77,12 +93,20 @@ macro_rules! otel_debug {
77
93
{
78
94
tracing:: debug!( name: $name, target: env!( "CARGO_PKG_NAME" ) , "" ) ;
79
95
}
96
+ #[ cfg( not( feature = "internal-logs" ) ) ]
97
+ {
98
+ let _ = $name; // Compiler will optimize this out as it's unused.
99
+ }
80
100
} ;
81
101
( name: $name: expr, $( $key: ident = $value: expr) ,+ $( , ) ?) => {
82
102
#[ cfg( feature = "internal-logs" ) ]
83
103
{
84
104
tracing:: debug!( name: $name, target: env!( "CARGO_PKG_NAME" ) , $( $key = $value) ,+, "" ) ;
85
105
}
106
+ #[ cfg( not( feature = "internal-logs" ) ) ]
107
+ {
108
+ let _ = ( $name, $( $value) ,+) ; // Compiler will optimize this out as it's unused.
109
+ }
86
110
} ;
87
111
}
88
112
@@ -104,11 +128,19 @@ macro_rules! otel_error {
104
128
{
105
129
tracing:: error!( name: $name, target: env!( "CARGO_PKG_NAME" ) , "" ) ;
106
130
}
131
+ #[ cfg( not( feature = "internal-logs" ) ) ]
132
+ {
133
+ let _ = $name; // Compiler will optimize this out as it's unused.
134
+ }
107
135
} ;
108
136
( name: $name: expr, $( $key: ident = $value: expr) ,+ $( , ) ?) => {
109
137
#[ cfg( feature = "internal-logs" ) ]
110
138
{
111
139
tracing:: error!( name: $name, target: env!( "CARGO_PKG_NAME" ) , $( $key = $value) ,+, "" ) ;
112
140
}
141
+ #[ cfg( not( feature = "internal-logs" ) ) ]
142
+ {
143
+ let _ = ( $name, $( $value) ,+) ; // Compiler will optimize this out as it's unused.
144
+ }
113
145
} ;
114
146
}
0 commit comments