Write to logfile as soon as we have the data, don't buffer.

Logfiles are important to see what happend, in particular if something
unexpected happened; so we want to make sure that the logfile is flushed
to disk.

Before this change, the logfile was typically written at the end in
a large chunk as the default (large) buffering applied. Now, characters are
written out ASAP, so it is possible to get a live-view with a
tail -f <logfile>
This commit is contained in:
Henner Zeller 2018-06-23 11:42:23 -07:00
parent 08fd18e803
commit 763a09e172

View file

@ -40,6 +40,7 @@ void log_open(const char *filename)
log_error = true;
exit(EXIT_FAILURE);
}
setvbuf(fp, NULL, _IONBF, 0);
}
void log_write(char c)