fflush stderr on Windows.

unfortunately, Windows will buffer stderr if it's not executed in `cmd.exe`,
which will cause unpleasant buffered log output. adding fflush(stderr) will
solve this aged issue.
This commit is contained in:
Symeon Huang
2014-11-13 23:55:34 +00:00
parent a578c35bd7
commit 5bf9f7e439
+4 -2
View File
@@ -98,7 +98,8 @@ extern FILE * logfile;
time_t now = time(NULL); \
char timestr[20]; \
strftime(timestr, 20, TIME_FORMAT, localtime(&now)); \
fprintf(stderr, " %s INFO: " format "\n", timestr, ## __VA_ARGS__); } \
fprintf(stderr, " %s INFO: " format "\n", timestr, ## __VA_ARGS__); \
fflush(stderr); } \
while (0)
#define LOGE(format, ...) \
@@ -106,7 +107,8 @@ extern FILE * logfile;
time_t now = time(NULL); \
char timestr[20]; \
strftime(timestr, 20, TIME_FORMAT, localtime(&now)); \
fprintf(stderr, " %s ERROR: " format "\n", timestr, ## __VA_ARGS__); } \
fprintf(stderr, " %s ERROR: " format "\n", timestr, ## __VA_ARGS__); \
fflush(stderr); } \
while (0)
#else