Tracing crate - blank line between log messages

Is there any way to make tracing put an (extra) newline after every log message? I mean so there is a line of whitespace after each log.

Looking thru the docs didn't turn up anything.

I was hoping for something like SubscriberBuilder.with_newlines()...

I'm using RollingFileAppender, though that shouldn't be relevant.

I thought it did that by default? Or do you mean putting a blank/empty line after each log message, i.e., emitting a total of two newlines per message?

Yes - a blank line (will edit).

I think you can accomplish this by wrapping whatever formatter you're already using (The default is Format<Full, SystemTime>, obtainable via the format() function) in a custom struct with a FormatEvent impl that passes the arguments to the inner formatter's format_event() and then calls writeln!(writer). Then you just pass this custom struct to the event_format() method of the Layer or SubscriberBuilder you're constructing. I'd show an example, but the tracing system has so many bells & whistles that whatever I came up with likely wouldn't directly map onto whatever your code is doing.

1 Like

Beauty - I discovered that pretty() has exactly this effect!