logging: Fix lost printk output when no newline
Log_output module was always postfixing printk strings with '\r'. If printk message did not ended with '\n' it lead to last printk message being overwritten. Fixed by adding '\r' only when string was ended by '\n'. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
e4505892bc
commit
2d6a226b2e
1 changed files with 9 additions and 1 deletions
|
@ -359,17 +359,25 @@ static void raw_string_print(struct log_msg *msg,
|
|||
|
||||
size_t offset = 0;
|
||||
size_t length;
|
||||
bool eol = false;
|
||||
|
||||
do {
|
||||
length = log_output->size;
|
||||
/* Sting is stored in a hexdump message. */
|
||||
log_msg_hexdump_data_get(msg, log_output->buf, &length, offset);
|
||||
log_output->control_block->offset = length;
|
||||
|
||||
if (length) {
|
||||
eol = (log_output->buf[length - 1] == '\n');
|
||||
}
|
||||
|
||||
log_output_flush(log_output);
|
||||
offset += length;
|
||||
} while (length > 0);
|
||||
|
||||
print_formatted(log_output, "\r");
|
||||
if (eol) {
|
||||
print_formatted(log_output, "\r");
|
||||
}
|
||||
}
|
||||
|
||||
static int prefix_print(struct log_msg *msg,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue