1- use std:: sync:: Mutex ;
21use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
2+ use std:: sync:: Mutex ;
33
4- use slog:: Drain ;
5- use log:: RecordBuilder ;
64use fragile:: Fragile ;
5+ use log:: RecordBuilder ;
6+ use slog:: Drain ;
77
88struct StdLogAssertExpected < ' a > {
99 expected : Mutex < Vec < Fragile < log:: Record < ' a > > > > ,
@@ -26,8 +26,8 @@ impl log::Log for StdLogAssertExpected<'_> {
2626 self . current_index. fetch_add( 1 , Ordering :: Acquire )
2727 ) ;
2828 e. get ( ) . clone ( )
29- } ,
30- None => panic ! ( "Expected no more log records. but got {:?}" , actual)
29+ }
30+ None => panic ! ( "Expected no more log records. but got {:?}" , actual) ,
3131 }
3232 } ;
3333 assert_eq ! ( expected. metadata( ) , actual. metadata( ) ) ;
@@ -70,15 +70,22 @@ macro_rules! record {
7070 . module_path( Some ( module_path!( ) ) )
7171 . target( module_path!( ) )
7272 . build( )
73- }
73+ } ;
7474}
7575
7676#[ test]
77+ #[ cfg_attr(
78+ feature = "kv_unstable" ,
79+ ignore = "TODO: Support kv-unstable feature (See PR #26)"
80+ ) ]
7781fn test_slog2log ( ) {
7882 let expected = vec ! [
7983 record!( Info , "Hello World!" ) ,
80- record!( Debug , "Hello World, I am 100 years old" )
81- ] . into_iter ( ) . map ( Fragile :: new) . collect :: < Vec < Fragile < log:: Record > > > ( ) ;
84+ record!( Debug , "Hello World, I am 100 years old" ) ,
85+ ]
86+ . into_iter ( )
87+ . map ( Fragile :: new)
88+ . collect :: < Vec < Fragile < log:: Record > > > ( ) ;
8289 let std_logger = Box :: leak ( Box :: new ( StdLogAssertExpected {
8390 expected : Mutex :: new ( expected) ,
8491 current_index : 0 . into ( ) ,
0 commit comments