From 1cb706c411e3bdf76dd56647683f75f9d639c650 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 20 May 2020 14:22:14 +0200 Subject: [PATCH] px4_log: flush each line Without this fix all PX4 output is buffered and presented at the very end of a scripted MAVSDK test which makes the log hard to read. --- platforms/common/px4_log.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platforms/common/px4_log.cpp b/platforms/common/px4_log.cpp index 0838d14ba8..a810b02a7f 100644 --- a/platforms/common/px4_log.cpp +++ b/platforms/common/px4_log.cpp @@ -136,6 +136,12 @@ __EXPORT void px4_log_modulename(int level, const char *moduleName, const char * orb_publish(ORB_ID(log_message), orb_log_message_pub, &log_message); } + +#ifdef CONFIG_ARCH_BOARD_PX4_SITL + // Without flushing it's tricky to see stdout output when PX4 is started by + // a script like for the MAVSDK tests. + fflush(out); +#endif } __EXPORT void px4_log_raw(int level, const char *fmt, ...)