@@ -23,12 +23,20 @@ macro_rules! otel_info {
2323 {
2424 tracing:: info!( name: $name, target: env!( "CARGO_PKG_NAME" ) , "" ) ;
2525 }
26+ #[ cfg( not( feature = "internal-logs" ) ) ]
27+ {
28+ let _ = $name; // Compiler will optimize this out as it's unused.
29+ }
2630 } ;
2731 ( name: $name: expr, $( $key: ident = $value: expr) ,+ $( , ) ?) => {
2832 #[ cfg( feature = "internal-logs" ) ]
2933 {
3034 tracing:: info!( name: $name, target: env!( "CARGO_PKG_NAME" ) , $( $key = $value) ,+, "" ) ;
3135 }
36+ #[ cfg( not( feature = "internal-logs" ) ) ]
37+ {
38+ let _ = ( $name, $( $value) ,+) ; // Compiler will optimize this out as it's unused.
39+ }
3240 } ;
3341}
3442
@@ -50,12 +58,20 @@ macro_rules! otel_warn {
5058 {
5159 tracing:: warn!( name: $name, target: env!( "CARGO_PKG_NAME" ) , "" ) ;
5260 }
61+ #[ cfg( not( feature = "internal-logs" ) ) ]
62+ {
63+ let _ = $name; // Compiler will optimize this out as it's unused.
64+ }
5365 } ;
5466 ( name: $name: expr, $( $key: ident = $value: expr) ,+ $( , ) ?) => {
5567 #[ cfg( feature = "internal-logs" ) ]
5668 {
5769 tracing:: warn!( name: $name, target: env!( "CARGO_PKG_NAME" ) , $( $key = $value) ,+, "" ) ;
5870 }
71+ #[ cfg( not( feature = "internal-logs" ) ) ]
72+ {
73+ let _ = ( $name, $( $value) ,+) ; // Compiler will optimize this out as it's unused.
74+ }
5975 } ;
6076}
6177
@@ -77,12 +93,20 @@ macro_rules! otel_debug {
7793 {
7894 tracing:: debug!( name: $name, target: env!( "CARGO_PKG_NAME" ) , "" ) ;
7995 }
96+ #[ cfg( not( feature = "internal-logs" ) ) ]
97+ {
98+ let _ = $name; // Compiler will optimize this out as it's unused.
99+ }
80100 } ;
81101 ( name: $name: expr, $( $key: ident = $value: expr) ,+ $( , ) ?) => {
82102 #[ cfg( feature = "internal-logs" ) ]
83103 {
84104 tracing:: debug!( name: $name, target: env!( "CARGO_PKG_NAME" ) , $( $key = $value) ,+, "" ) ;
85105 }
106+ #[ cfg( not( feature = "internal-logs" ) ) ]
107+ {
108+ let _ = ( $name, $( $value) ,+) ; // Compiler will optimize this out as it's unused.
109+ }
86110 } ;
87111}
88112
@@ -104,11 +128,19 @@ macro_rules! otel_error {
104128 {
105129 tracing:: error!( name: $name, target: env!( "CARGO_PKG_NAME" ) , "" ) ;
106130 }
131+ #[ cfg( not( feature = "internal-logs" ) ) ]
132+ {
133+ let _ = $name; // Compiler will optimize this out as it's unused.
134+ }
107135 } ;
108136 ( name: $name: expr, $( $key: ident = $value: expr) ,+ $( , ) ?) => {
109137 #[ cfg( feature = "internal-logs" ) ]
110138 {
111139 tracing:: error!( name: $name, target: env!( "CARGO_PKG_NAME" ) , $( $key = $value) ,+, "" ) ;
112140 }
141+ #[ cfg( not( feature = "internal-logs" ) ) ]
142+ {
143+ let _ = ( $name, $( $value) ,+) ; // Compiler will optimize this out as it's unused.
144+ }
113145 } ;
114146}
0 commit comments