@@ -160,6 +160,7 @@ fn android_log(
160
160
fn android_log ( _buf_id : Option < LogId > , _priority : Level , _tag : & CStr , _msg : & CStr ) { }
161
161
162
162
/// Underlying android logger backend
163
+ #[ derive( Debug , Default ) ]
163
164
pub struct AndroidLogger {
164
165
config : OnceLock < Config > ,
165
166
}
@@ -183,15 +184,6 @@ static ANDROID_LOGGER: OnceLock<AndroidLogger> = OnceLock::new();
183
184
const LOGGING_TAG_MAX_LEN : usize = 127 ;
184
185
const LOGGING_MSG_MAX_LEN : usize = 4000 ;
185
186
186
- impl Default for AndroidLogger {
187
- /// Create a new logger with default config
188
- fn default ( ) -> AndroidLogger {
189
- AndroidLogger {
190
- config : OnceLock :: from ( Config :: default ( ) ) ,
191
- }
192
- }
193
- }
194
-
195
187
impl Log for AndroidLogger {
196
188
fn enabled ( & self , metadata : & Metadata ) -> bool {
197
189
let config = self . config ( ) ;
@@ -226,7 +218,7 @@ impl Log for AndroidLogger {
226
218
227
219
// In case we end up allocating, keep the CString alive.
228
220
let _owned_tag;
229
- let tag: & CStr = if tag. len ( ) < tag_bytes. len ( ) {
221
+ let tag = if tag. len ( ) < tag_bytes. len ( ) {
230
222
// truncate the tag here to fit into LOGGING_TAG_MAX_LEN
231
223
fill_tag_bytes ( & mut tag_bytes, tag)
232
224
} else {
@@ -306,6 +298,24 @@ pub struct Config {
306
298
custom_format : Option < FormatFn > ,
307
299
}
308
300
301
+ impl fmt:: Debug for Config {
302
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
303
+ f. debug_struct ( "Config" )
304
+ . field ( "log_level" , & self . log_level )
305
+ . field ( "buf_id" , & self . buf_id )
306
+ . field ( "filter" , & self . filter )
307
+ . field ( "tag" , & self . tag )
308
+ . field (
309
+ "custom_format" ,
310
+ match & self . custom_format {
311
+ Some ( _) => & "Some(_)" ,
312
+ None => & "None" ,
313
+ } ,
314
+ )
315
+ . finish ( )
316
+ }
317
+ }
318
+
309
319
impl Config {
310
320
/// Changes the maximum log level.
311
321
///
0 commit comments