From d8173c82535f9bec0acd371d2fcc953c3fd1dc65 Mon Sep 17 00:00:00 2001 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net> Date: Tue, 2 Aug 2016 15:58:52 -0400 Subject: [PATCH] Ensure that kr_log_info() gets sent promptly to stdout If stdout is buffered, kr_log_info() might take ages to show up in the output stream. Since this stream could be interleaved with stderr (e.g. kr_log_error()), it would be good to be able to see the messages in the order in which they are generated. --- lib/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.h b/lib/utils.h index 5d4c537ea..dfcc55f6f 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -28,7 +28,7 @@ /* * Logging and debugging. */ -#define kr_log_info(fmt, ...) printf((fmt), ## __VA_ARGS__) +#define kr_log_info(fmt, ...) do { printf((fmt), ## __VA_ARGS__); fflush(stdout); } while(0) #define kr_log_error(fmt, ...) fprintf(stderr, (fmt), ## __VA_ARGS__) #ifndef NDEBUG /* Toggle debug messages */ -- GitLab