File tree 2 files changed +17
-6
lines changed
2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,7 @@ impl Buffers {
222
222
223
223
pub struct FmtEvent < ' a > {
224
224
pub bufs : & ' a mut Buffers ,
225
+ pub lines : bool ,
225
226
}
226
227
227
228
impl < ' a > Visit for FmtEvent < ' a > {
@@ -235,7 +236,12 @@ impl<'a> Visit for FmtEvent<'a> {
235
236
#[ cfg( feature = "tracing-log" ) ]
236
237
name if name. starts_with ( "log." ) => { }
237
238
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 ( ) ;
239
245
}
240
246
}
241
247
}
Original file line number Diff line number Diff line change @@ -212,16 +212,18 @@ where
212
212
V : fmt:: Display + ' a ,
213
213
{
214
214
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 " )
217
219
} else {
218
- " \n "
220
+ ( ", " , " " )
219
221
} ;
220
222
if let Some ( ( k, v) ) = kvs. next ( ) {
221
223
if k == "message" {
222
224
write ! ( buf, " {}" , v) ?;
223
225
} else {
224
- write ! ( buf, "{nl }{}={}" , k, v) ?;
226
+ write ! ( buf, "{first }{}={}" , k, v) ?;
225
227
}
226
228
}
227
229
for ( k, v) in kvs {
@@ -412,7 +414,10 @@ where
412
414
. expect ( "Unable to write to buffer" ) ;
413
415
}
414
416
415
- let mut visitor = FmtEvent { bufs } ;
417
+ let mut visitor = FmtEvent {
418
+ bufs,
419
+ lines : self . config . indent_lines ,
420
+ } ;
416
421
event. record ( & mut visitor) ;
417
422
visitor
418
423
. bufs
You can’t perform that action at this time.
0 commit comments