#undef WARN
#undef ERR
+#ifdef MDS_STDOUT
+#include <stdio.h>
+#define __DBG(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
+#define __INFO(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
+#define __WARN(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
+#define __ERR(fmt, arg...) printf("[Modes]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
+#else
#define LOG_TAG "MODES"
#include <dlog.h>
+#define __DBG(fmt, arg...) SLOGD(fmt, ##arg)
+#define __INFO(fmt, arg...) SLOGI(fmt, ##arg)
+#define __WARN(fmt, arg...) SLOGW(fmt, ##arg)
+#define __ERR(fmt, arg...) SLOGE(fmt, ##arg)
+#endif /* MDS_STDOUT */
-#ifdef MDS_SUPERVISOR
-
-#define _DBG(fmt, arg...) SLOGD(MDS_LOG_BROWN "<Daemon>" MDS_LOG_END fmt, ##arg)
-#define _INFO(fmt, arg...) SLOGI(MDS_LOG_BLUE "<Daemon>" MDS_LOG_END fmt, ##arg)
-#define _WARN(fmt, arg...) SLOGW(MDS_LOG_GREEN "<Daemon>" MDS_LOG_END fmt, ##arg)
-#define _ERR(fmt, arg...) SLOGE(MDS_LOG_RED "<Daemon>" MDS_LOG_END fmt, ##arg)
+#ifdef MDS_SUPERVISOR
+#define _DBG(fmt, arg...) __DBG(MDS_LOG_BROWN "<Daemon>" MDS_LOG_END fmt, ##arg)
+#define _INFO(fmt, arg...) __INFO(MDS_LOG_BLUE "<Daemon>" MDS_LOG_END fmt, ##arg)
+#define _WARN(fmt, arg...) __WARN(MDS_LOG_GREEN "<Daemon>" MDS_LOG_END fmt, ##arg)
+#define _ERR(fmt, arg...) __ERR(MDS_LOG_RED "<Daemon>" MDS_LOG_END fmt, ##arg)
#elif defined(MDS_CLIENT)
-
-#define _DBG(fmt, arg...) SLOGD(MDS_LOG_BROWN "<Client>" MDS_LOG_END fmt, ##arg)
-#define _INFO(fmt, arg...) SLOGI(MDS_LOG_BLUE "<Client>" MDS_LOG_END fmt, ##arg)
-#define _WARN(fmt, arg...) SLOGW(MDS_LOG_GREEN "<Client>" MDS_LOG_END fmt, ##arg)
-#define _ERR(fmt, arg...) SLOGE(MDS_LOG_RED "<Client>" MDS_LOG_END fmt, ##arg)
-
+#define _DBG(fmt, arg...) __DBG(MDS_LOG_BROWN "<Client>" MDS_LOG_END fmt, ##arg)
+#define _INFO(fmt, arg...) __INFO(MDS_LOG_BLUE "<Client>" MDS_LOG_END fmt, ##arg)
+#define _WARN(fmt, arg...) __WARN(MDS_LOG_GREEN "<Client>" MDS_LOG_END fmt, ##arg)
+#define _ERR(fmt, arg...) __ERR(MDS_LOG_RED "<Client>" MDS_LOG_END fmt, ##arg)
#elif defined(MDS_MODULE)
-
-#define _DBG(fmt, arg...) SLOGD(MDS_LOG_BROWN "<Module>" MDS_LOG_END fmt, ##arg)
-#define _INFO(fmt, arg...) SLOGI(MDS_LOG_BLUE "<Module>" MDS_LOG_END fmt, ##arg)
-#define _WARN(fmt, arg...) SLOGW(MDS_LOG_GREEN "<Module>" MDS_LOG_END fmt, ##arg)
-#define _ERR(fmt, arg...) SLOGE(MDS_LOG_RED "<Module>" MDS_LOG_END fmt, ##arg)
-
+#define _DBG(fmt, arg...) __DBG(MDS_LOG_BROWN "<Module>" MDS_LOG_END fmt, ##arg)
+#define _INFO(fmt, arg...) __INFO(MDS_LOG_BLUE "<Module>" MDS_LOG_END fmt, ##arg)
+#define _WARN(fmt, arg...) __WARN(MDS_LOG_GREEN "<Module>" MDS_LOG_END fmt, ##arg)
+#define _ERR(fmt, arg...) __ERR(MDS_LOG_RED "<Module>" MDS_LOG_END fmt, ##arg)
#else
-
-#define _DBG(fmt, arg...) SLOGD(fmt, ##arg)
-#define _INFO(fmt, arg...) SLOGI(fmt, ##arg)
-#define _WARN(fmt, arg...) SLOGW(fmt, ##arg)
-#define _ERR(fmt, arg...) SLOGE(fmt, ##arg)
-
+#define _DBG(fmt, arg...) __DBG(fmt, ##arg)
+#define _INFO(fmt, arg...) __INFO(fmt, ##arg)
+#define _WARN(fmt, arg...) __WARN(fmt, ##arg)
+#define _ERR(fmt, arg...) __ERR(fmt, ##arg)
#endif /* MDS_SUPERVISOR */
#define MDS_DEBUGGING