Provide an easy-to-use way to manipulate ESP8266.

Dependencies:   ArduinoAPI

Fork of WeeESP8266 by ITEAD STUDIO

Revision:
11:e9bee504024d
Child:
15:5c5a85e984a8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/log.h	Sat Feb 07 06:12:09 2015 +0000
@@ -0,0 +1,79 @@
+#ifndef __DEBUG_H__
+#define __DEBUG_H__
+
+#include "mbed.h"
+
+#define LOG_OUTPUT_ERROR              (1)
+#define LOG_OUTPUT_WARN               (1)
+#define LOG_OUTPUT_INFO               (1)
+#define LOG_OUTPUT_DEBUG              (1)
+#define LOG_OUTPUT_VERBOSE            (1)
+
+#define LOG_OUTPUT_ERROR_PREFIX       (1)
+#define LOG_OUTPUT_WARN_PREFIX        (1)
+#define LOG_OUTPUT_INFO_PREFIX        (0)
+#define LOG_OUTPUT_DEBUG_PREFIX       (0)
+#define LOG_OUTPUT_VERBOSE_PREFIX     (0)
+
+extern Serial pc;
+
+#define logOut pc.printf
+
+#define logError(fmt, args...)\
+    do {\
+        if (LOG_OUTPUT_ERROR)\
+        {\
+            if(LOG_OUTPUT_ERROR_PREFIX)\
+                logOut("[LOG Error:%s,%d,%s] ",__FILE__,__LINE__,__FUNCTION__);\
+            logOut(fmt, ##args);\
+            logOut("\r\n");\
+        }\
+    } while(0)
+
+#define logWarn(fmt, args...)\
+    do {\
+        if (LOG_OUTPUT_WARN)\
+        {\
+            if(LOG_OUTPUT_WARN_PREFIX)\
+                logOut("[LOG Warn:%s,%d,%s] ",__FILE__,__LINE__,__FUNCTION__);\
+            logOut(fmt, ##args);\
+            logOut("\r\n");\
+        }\
+    } while(0)
+
+#define logDebug(fmt, args...)\
+    do {\
+        if (LOG_OUTPUT_DEBUG)\
+        {\
+            if (LOG_OUTPUT_DEBUG_PREFIX)\
+                logOut("[LOG Debug:%s,%d,%s] ",__FILE__,__LINE__,__FUNCTION__);\
+            logOut(fmt, ##args);\
+            logOut("\r\n");\
+        }\
+    } while(0)
+
+#define logInfo(fmt, args...)\
+    do {\
+        if (LOG_OUTPUT_INFO)\
+        {\
+            if (LOG_OUTPUT_INFO_PREFIX)\
+                logOut("[LOG Info:%s,%d,%s] ",__FILE__,__LINE__,__FUNCTION__);\
+            logOut(fmt, ##args);\
+            logOut("\r\n");\
+        }\
+    } while(0)
+        
+
+#define logVerbose(fmt, args...)\
+    do {\
+        if (LOG_OUTPUT_VERBOSE)\
+        {\
+            if (LOG_OUTPUT_VERBOSE_PREFIX)\
+                logOut("[LOG Verbose:%s,%d,%s] ",__FILE__,__LINE__,__FUNCTION__);\
+            logOut(fmt, ##args);\
+            logOut("\r\n");\
+        }\
+    } while(0)
+
+
+#endif /* #ifndef __DEBUG_H__ */
\ No newline at end of file