trace_logger: avoid output of empty lines

It avoids output of empty lines in output buffer if traced messages end
with \n (what is common with messages logged from dde_linux).

Issue #3714
This commit is contained in:
Tomasz Gajewski 2020-04-01 00:39:24 +02:00 committed by Christian Helmuth
parent 870d348d77
commit 4639978b3a
1 changed files with 4 additions and 0 deletions

View File

@ -124,6 +124,10 @@ void Monitor::print(bool activity, bool affinity)
memcpy(_curr_entry_data, entry.data(), length);
_curr_entry_data[length] = '\0';
/* avoid output of empty lines due to end of line character at end */
if (_curr_entry_data[length - 1] == '\n')
_curr_entry_data[length - 1] = '\0';
/* print copied entry data out to log */
if (!printed_buf_entries) {
log(" <buffer>");