Merge pull request #3839 from povik/python-log-newline

This commit is contained in:
N. Engelhardt 2023-07-24 16:28:02 +02:00 committed by GitHub
commit 5e8db7000c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -147,6 +147,12 @@ void logv(const char *format, va_list ap)
if (format[0] && format[strlen(format)-1] == '\n') if (format[0] && format[strlen(format)-1] == '\n')
next_print_log = true; next_print_log = true;
// Special case to detect newlines in Python log output, since
// the binding always calls `log("%s", payload)` and the newline
// is then in the first formatted argument
if (!strcmp(format, "%s") && str.back() == '\n')
next_print_log = true;
for (auto f : log_files) for (auto f : log_files)
fputs(time_str.c_str(), f); fputs(time_str.c_str(), f);