@@ -267,23 +267,28 @@ pub struct PlatformLogWriter<'a> {
267
267
268
268
impl < ' a > PlatformLogWriter < ' a > {
269
269
#[ cfg( target_os = "android" ) ]
270
- pub fn new ( level : Level , tag : & CStr ) -> PlatformLogWriter {
270
+ pub fn new_with_priority ( priority : log_ffi :: LogPriority , tag : & CStr ) -> PlatformLogWriter {
271
271
#[ allow( deprecated) ] // created an issue #35 for this
272
272
PlatformLogWriter {
273
- priority : match level {
274
- Level :: Warn => LogPriority :: WARN ,
275
- Level :: Info => LogPriority :: INFO ,
276
- Level :: Debug => LogPriority :: DEBUG ,
277
- Level :: Error => LogPriority :: ERROR ,
278
- Level :: Trace => LogPriority :: VERBOSE ,
279
- } ,
273
+ priority,
280
274
len : 0 ,
281
275
last_newline_index : 0 ,
282
276
tag,
283
277
buffer : uninit_array ( ) ,
284
278
}
285
279
}
286
280
281
+ #[ cfg( target_os = "android" ) ]
282
+ pub fn new ( level : Level , tag : & CStr ) -> PlatformLogWriter {
283
+ Self :: new_with_priority ( match level {
284
+ Level :: Warn => LogPriority :: WARN ,
285
+ Level :: Info => LogPriority :: INFO ,
286
+ Level :: Debug => LogPriority :: DEBUG ,
287
+ Level :: Error => LogPriority :: ERROR ,
288
+ Level :: Trace => LogPriority :: VERBOSE ,
289
+ } )
290
+ }
291
+
287
292
#[ cfg( not( target_os = "android" ) ) ]
288
293
pub fn new ( level : Level , tag : & CStr ) -> PlatformLogWriter {
289
294
#[ allow( deprecated) ] // created an issue #35 for this
0 commit comments