34
34
//!
35
35
//! # Key Value arguments
36
36
//!
37
- //! If the `unstable- kv` feature is enabled, then the default format will include key values from
37
+ //! If the `kv` feature is enabled, then the default format will include key values from
38
38
//! the log by default, but this can be disabled by calling [`Builder::format_key_values`]
39
39
//! with [`hidden_kv_format`] as the format function.
40
40
//!
41
41
//! The way these keys and values are formatted can also be customized with a separate format
42
42
//! function that is called by the default format with [`Builder::format_key_values`].
43
43
//!
44
44
//! ```
45
- //! # #[cfg(feature= "unstable- kv")]
45
+ //! # #[cfg(feature= "kv")]
46
46
//! # {
47
47
//! use log::info;
48
48
//! env_logger::init();
@@ -69,7 +69,7 @@ use log::Record;
69
69
70
70
#[ cfg( feature = "humantime" ) ]
71
71
mod humantime;
72
- #[ cfg( feature = "unstable- kv" ) ]
72
+ #[ cfg( feature = "kv" ) ]
73
73
mod kv;
74
74
pub ( crate ) mod writer;
75
75
@@ -78,7 +78,7 @@ pub use anstyle as style;
78
78
79
79
#[ cfg( feature = "humantime" ) ]
80
80
pub use self :: humantime:: Timestamp ;
81
- #[ cfg( feature = "unstable- kv" ) ]
81
+ #[ cfg( feature = "kv" ) ]
82
82
pub use self :: kv:: * ;
83
83
pub use self :: writer:: Target ;
84
84
pub use self :: writer:: WriteStyle ;
@@ -212,7 +212,7 @@ pub(crate) struct Builder {
212
212
pub ( crate ) format_suffix : & ' static str ,
213
213
pub ( crate ) format_file : bool ,
214
214
pub ( crate ) format_line_number : bool ,
215
- #[ cfg( feature = "unstable- kv" ) ]
215
+ #[ cfg( feature = "kv" ) ]
216
216
pub ( crate ) kv_format : Option < Box < KvFormatFn > > ,
217
217
built : bool ,
218
218
}
@@ -248,7 +248,7 @@ impl Builder {
248
248
suffix : built. format_suffix ,
249
249
source_file : built. format_file ,
250
250
source_line_number : built. format_line_number ,
251
- #[ cfg( feature = "unstable- kv" ) ]
251
+ #[ cfg( feature = "kv" ) ]
252
252
kv_format : built. kv_format . as_deref ( ) . unwrap_or ( & default_kv_format) ,
253
253
buf,
254
254
} ;
@@ -271,7 +271,7 @@ impl Default for Builder {
271
271
format_indent : Some ( 4 ) ,
272
272
custom_format : None ,
273
273
format_suffix : "\n " ,
274
- #[ cfg( feature = "unstable- kv" ) ]
274
+ #[ cfg( feature = "kv" ) ]
275
275
kv_format : None ,
276
276
built : false ,
277
277
}
@@ -321,7 +321,7 @@ struct DefaultFormat<'a> {
321
321
indent : Option < usize > ,
322
322
buf : & ' a mut Formatter ,
323
323
suffix : & ' a str ,
324
- #[ cfg( feature = "unstable- kv" ) ]
324
+ #[ cfg( feature = "kv" ) ]
325
325
kv_format : & ' a KvFormatFn ,
326
326
}
327
327
@@ -335,7 +335,7 @@ impl DefaultFormat<'_> {
335
335
self . finish_header ( ) ?;
336
336
337
337
self . write_args ( record) ?;
338
- #[ cfg( feature = "unstable- kv" ) ]
338
+ #[ cfg( feature = "kv" ) ]
339
339
self . write_kv ( record) ?;
340
340
write ! ( self . buf, "{}" , self . suffix)
341
341
}
@@ -518,7 +518,7 @@ impl DefaultFormat<'_> {
518
518
}
519
519
}
520
520
521
- #[ cfg( feature = "unstable- kv" ) ]
521
+ #[ cfg( feature = "kv" ) ]
522
522
fn write_kv ( & mut self , record : & Record < ' _ > ) -> io:: Result < ( ) > {
523
523
let format = self . kv_format ;
524
524
format ( self . buf , record. key_values ( ) )
@@ -577,7 +577,7 @@ mod tests {
577
577
level : true ,
578
578
source_file : false ,
579
579
source_line_number : false ,
580
- #[ cfg( feature = "unstable- kv" ) ]
580
+ #[ cfg( feature = "kv" ) ]
581
581
kv_format : & hidden_kv_format,
582
582
written_header_value : false ,
583
583
indent : None ,
@@ -599,7 +599,7 @@ mod tests {
599
599
level : false ,
600
600
source_file : false ,
601
601
source_line_number : false ,
602
- #[ cfg( feature = "unstable- kv" ) ]
602
+ #[ cfg( feature = "kv" ) ]
603
603
kv_format : & hidden_kv_format,
604
604
written_header_value : false ,
605
605
indent : None ,
@@ -621,7 +621,7 @@ mod tests {
621
621
level : true ,
622
622
source_file : false ,
623
623
source_line_number : false ,
624
- #[ cfg( feature = "unstable- kv" ) ]
624
+ #[ cfg( feature = "kv" ) ]
625
625
kv_format : & hidden_kv_format,
626
626
written_header_value : false ,
627
627
indent : Some ( 4 ) ,
@@ -643,7 +643,7 @@ mod tests {
643
643
level : true ,
644
644
source_file : false ,
645
645
source_line_number : false ,
646
- #[ cfg( feature = "unstable- kv" ) ]
646
+ #[ cfg( feature = "kv" ) ]
647
647
kv_format : & hidden_kv_format,
648
648
written_header_value : false ,
649
649
indent : Some ( 0 ) ,
@@ -665,7 +665,7 @@ mod tests {
665
665
level : false ,
666
666
source_file : false ,
667
667
source_line_number : false ,
668
- #[ cfg( feature = "unstable- kv" ) ]
668
+ #[ cfg( feature = "kv" ) ]
669
669
kv_format : & hidden_kv_format,
670
670
written_header_value : false ,
671
671
indent : Some ( 4 ) ,
@@ -687,7 +687,7 @@ mod tests {
687
687
level : false ,
688
688
source_file : false ,
689
689
source_line_number : false ,
690
- #[ cfg( feature = "unstable- kv" ) ]
690
+ #[ cfg( feature = "kv" ) ]
691
691
kv_format : & hidden_kv_format,
692
692
written_header_value : false ,
693
693
indent : None ,
@@ -709,7 +709,7 @@ mod tests {
709
709
level : false ,
710
710
source_file : false ,
711
711
source_line_number : false ,
712
- #[ cfg( feature = "unstable- kv" ) ]
712
+ #[ cfg( feature = "kv" ) ]
713
713
kv_format : & hidden_kv_format,
714
714
written_header_value : false ,
715
715
indent : Some ( 4 ) ,
@@ -733,7 +733,7 @@ mod tests {
733
733
level : true ,
734
734
source_file : false ,
735
735
source_line_number : false ,
736
- #[ cfg( feature = "unstable- kv" ) ]
736
+ #[ cfg( feature = "kv" ) ]
737
737
kv_format : & hidden_kv_format,
738
738
written_header_value : false ,
739
739
indent : None ,
@@ -756,7 +756,7 @@ mod tests {
756
756
level : true ,
757
757
source_file : false ,
758
758
source_line_number : false ,
759
- #[ cfg( feature = "unstable- kv" ) ]
759
+ #[ cfg( feature = "kv" ) ]
760
760
kv_format : & hidden_kv_format,
761
761
written_header_value : false ,
762
762
indent : None ,
@@ -780,7 +780,7 @@ mod tests {
780
780
level : true ,
781
781
source_file : false ,
782
782
source_line_number : false ,
783
- #[ cfg( feature = "unstable- kv" ) ]
783
+ #[ cfg( feature = "kv" ) ]
784
784
kv_format : & hidden_kv_format,
785
785
written_header_value : false ,
786
786
indent : None ,
@@ -803,7 +803,7 @@ mod tests {
803
803
level : true ,
804
804
source_file : true ,
805
805
source_line_number : true ,
806
- #[ cfg( feature = "unstable- kv" ) ]
806
+ #[ cfg( feature = "kv" ) ]
807
807
kv_format : & hidden_kv_format,
808
808
written_header_value : false ,
809
809
indent : None ,
@@ -814,7 +814,7 @@ mod tests {
814
814
assert_eq ! ( "[INFO test.rs:144] log\n message\n " , written) ;
815
815
}
816
816
817
- #[ cfg( feature = "unstable- kv" ) ]
817
+ #[ cfg( feature = "kv" ) ]
818
818
#[ test]
819
819
fn format_kv_default ( ) {
820
820
let kvs = & [ ( "a" , 1u32 ) , ( "b" , 2u32 ) ] [ ..] ;
@@ -846,7 +846,7 @@ mod tests {
846
846
assert_eq ! ( "[INFO ] log message a=1 b=2\n " , written) ;
847
847
}
848
848
849
- #[ cfg( feature = "unstable- kv" ) ]
849
+ #[ cfg( feature = "kv" ) ]
850
850
#[ test]
851
851
fn format_kv_default_full ( ) {
852
852
let kvs = & [ ( "a" , 1u32 ) , ( "b" , 2u32 ) ] [ ..] ;
0 commit comments