Commit 25d6a422 authored by Ulrich Huber's avatar Ulrich Huber Committed by Oliver Horst
Browse files

[fix] Normalize output for missing newline or return characters

parent b9699471
......@@ -17,5 +17,20 @@ void toki_log(const char* severity, const char* facility, const char* format, ..
va_list va;
va_start(va, format);
printf(format, va);
/*
* Normalize newline at end of log message (required for many components as they output
* log messages with missing new-line or missing return-character skewing our formatting)
*/
int format_len = strlen(format);
if (format_len >= 2 && format[format_len - 2] != '\r' && format[format_len - 1] != '\r')
{
printf("\r");
}
if (format_len >= 1 && format[format_len - 1] != '\n')
{
printf("\n");
}
va_end(va);
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment