BugID:16952476: Improve iotx_log
@@ -42,7 +42,7 @@ void LITE_syslog(char *m, const char *f, const int l, const int level, const
#if (CONFIG_RUNTIME_LOG_LEVEL <= LOG_DEBUG_LEVEL)
#define log_debug(mod, ...) LITE_syslog(mod, __FUNCTION__, __LINE__, LOG_DEBUG_LEVEL, __VA_ARGS__)
#else
-#define log_debug(mod, ...) LITE_printf("[dbg] "), LITE_printf(__VA_ARGS__), LITE_printf("\r\n")
+#define log_debug(mod, ...) do {LITE_printf("[dbg] "); LITE_printf(__VA_ARGS__); LITE_printf("\r\n");} while(0)
#endif
#endif /* CONFIG_BLDTIME_MUTE_DBGLOG */
@@ -50,31 +50,31 @@ void LITE_syslog(char *m, const char *f, const int l, const int level, const
#if (CONFIG_RUNTIME_LOG_LEVEL <= LOG_INFO_LEVEL)
#define log_info(mod, ...) LITE_syslog(mod, __FUNCTION__, __LINE__, LOG_INFO_LEVEL, __VA_ARGS__)
#else
-#define log_info(mod, ...) LITE_printf("[inf] "), LITE_printf(__VA_ARGS__), LITE_printf("\r\n")
+#define log_info(mod, ...) do {LITE_printf("[inf] "); LITE_printf(__VA_ARGS__); LITE_printf("\r\n");} while(0)
#endif
#if (CONFIG_RUNTIME_LOG_LEVEL <= LOG_WARNING_LEVEL)
#define log_warning(mod, ...) LITE_syslog(mod, __FUNCTION__, __LINE__, LOG_WARNING_LEVEL, __VA_ARGS__)
#else
-#define log_warning(mod, ...) LITE_printf("[wrn] "), LITE_printf(__VA_ARGS__), LITE_printf("\r\n")
+#define log_warning(mod, ...) do {LITE_printf("[wrn] "); LITE_printf(__VA_ARGS__); LITE_printf("\r\n");} while(0)
#endif
#if (CONFIG_RUNTIME_LOG_LEVEL <= LOG_ERR_LEVEL)
#define log_err(mod, ...) LITE_syslog(mod, __FUNCTION__, __LINE__, LOG_ERR_LEVEL, __VA_ARGS__)
#else
-#define log_err(mod, ...) LITE_printf("[err] "), LITE_printf(__VA_ARGS__), LITE_printf("\r\n")
+#define log_err(mod, ...) do {LITE_printf("[err] "); LITE_printf(__VA_ARGS__); LITE_printf("\r\n");} while(0)
#endif
#if (CONFIG_RUNTIME_LOG_LEVEL <= LOG_CRIT_LEVEL)
#define log_crit(mod, ...) LITE_syslog(mod, __FUNCTION__, __LINE__, LOG_CRIT_LEVEL, __VA_ARGS__)
#else
-#define log_crit(mod, ...) LITE_printf("[crt] "), LITE_printf(__VA_ARGS__), LITE_printf("\r\n")
+#define log_crit(mod, ...) do {LITE_printf("[crt] "); LITE_printf(__VA_ARGS__); LITE_printf("\r\n");} while(0)
#endif
#if (CONFIG_RUNTIME_LOG_LEVEL <= LOG_EMERG_LEVEL)
#define log_emerg(mod, ...) LITE_syslog(mod, __FUNCTION__, __LINE__, LOG_EMERG_LEVEL, __VA_ARGS__)
#else
-#define log_emerg(mod, ...) LITE_printf("[emg] "), LITE_printf(__VA_ARGS__), LITE_printf("\r\n")
+#define log_emerg(mod, ...) do {LITE_printf("[emg] ");LITE_printf(__VA_ARGS__);LITE_printf("\r\n");} while(0)
#endif
int log_multi_line_internal(const char *f, const int l,
