File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,7 @@ impl Buffers {
222222
223223pub struct FmtEvent < ' a > {
224224 pub bufs : & ' a mut Buffers ,
225+ pub lines : bool ,
225226}
226227
227228impl < ' a > Visit for FmtEvent < ' a > {
@@ -235,7 +236,12 @@ impl<'a> Visit for FmtEvent<'a> {
235236 #[ cfg( feature = "tracing-log" ) ]
236237 name if name. starts_with ( "log." ) => { }
237238 name => {
238- write ! ( buf, "\n {}={:?}" , name, value) . unwrap ( ) ;
239+ if self . lines {
240+ write ! ( buf, "\n " ) . unwrap ( )
241+ } else {
242+ write ! ( buf, ", " ) . unwrap ( )
243+ }
244+ write ! ( buf, "{}={:?}" , name, value) . unwrap ( ) ;
239245 }
240246 }
241247 }
Original file line number Diff line number Diff line change @@ -212,16 +212,18 @@ where
212212 V : fmt:: Display + ' a ,
213213 {
214214 let mut kvs = kvs. into_iter ( ) ;
215- let nl = if self . config . bracketed_fields {
216- ""
215+ let ( nl, first) = if self . config . bracketed_fields {
216+ ( "" , "" )
217+ } else if self . config . indent_lines {
218+ ( "\n " , "\n " )
217219 } else {
218- " \n "
220+ ( ", " , " " )
219221 } ;
220222 if let Some ( ( k, v) ) = kvs. next ( ) {
221223 if k == "message" {
222224 write ! ( buf, " {}" , v) ?;
223225 } else {
224- write ! ( buf, "{nl }{}={}" , k, v) ?;
226+ write ! ( buf, "{first }{}={}" , k, v) ?;
225227 }
226228 }
227229 for ( k, v) in kvs {
@@ -412,7 +414,10 @@ where
412414 . expect ( "Unable to write to buffer" ) ;
413415 }
414416
415- let mut visitor = FmtEvent { bufs } ;
417+ let mut visitor = FmtEvent {
418+ bufs,
419+ lines : self . config . indent_lines ,
420+ } ;
416421 event. record ( & mut visitor) ;
417422 visitor
418423 . bufs
You can’t perform that action at this time.
0 commit comments