USE YHTANG AWS ACCOUNT TO TEST MQTT
Dependents: NuMaker-mbed-AWS-IoT-example
MQTT_logging.h@41:b7e86fa6dbb8, 2014-08-15 (annotated)
- Committer:
- icraggs
- Date:
- Fri Aug 15 10:23:56 2014 +0000
- Revision:
- 41:b7e86fa6dbb8
Add logging and getter for EthernetInterface object
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
icraggs | 41:b7e86fa6dbb8 | 1 | #if !defined(MQTT_LOGGING_H) |
icraggs | 41:b7e86fa6dbb8 | 2 | #define MQTT_LOGGING_H |
icraggs | 41:b7e86fa6dbb8 | 3 | |
icraggs | 41:b7e86fa6dbb8 | 4 | #define STREAM stdout |
icraggs | 41:b7e86fa6dbb8 | 5 | #if !defined(DEBUG) |
icraggs | 41:b7e86fa6dbb8 | 6 | #define DEBUG(...) \ |
icraggs | 41:b7e86fa6dbb8 | 7 | {\ |
icraggs | 41:b7e86fa6dbb8 | 8 | fprintf(STREAM, "DEBUG: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
icraggs | 41:b7e86fa6dbb8 | 9 | fprintf(STREAM, ##__VA_ARGS__); \ |
icraggs | 41:b7e86fa6dbb8 | 10 | fflush(STREAM); \ |
icraggs | 41:b7e86fa6dbb8 | 11 | } |
icraggs | 41:b7e86fa6dbb8 | 12 | #endif |
icraggs | 41:b7e86fa6dbb8 | 13 | #if !defined(LOG) |
icraggs | 41:b7e86fa6dbb8 | 14 | #define LOG(...) \ |
icraggs | 41:b7e86fa6dbb8 | 15 | {\ |
icraggs | 41:b7e86fa6dbb8 | 16 | fprintf(STREAM, "LOG: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
icraggs | 41:b7e86fa6dbb8 | 17 | fprintf(STREAM, ##__VA_ARGS__); \ |
icraggs | 41:b7e86fa6dbb8 | 18 | fflush(STREAM); \ |
icraggs | 41:b7e86fa6dbb8 | 19 | } |
icraggs | 41:b7e86fa6dbb8 | 20 | #endif |
icraggs | 41:b7e86fa6dbb8 | 21 | #if !defined(WARN) |
icraggs | 41:b7e86fa6dbb8 | 22 | #define WARN(...) \ |
icraggs | 41:b7e86fa6dbb8 | 23 | { \ |
icraggs | 41:b7e86fa6dbb8 | 24 | fprintf(STREAM, "WARN: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
icraggs | 41:b7e86fa6dbb8 | 25 | fprintf(STREAM, ##__VA_ARGS__); \ |
icraggs | 41:b7e86fa6dbb8 | 26 | fflush(STREAM); \ |
icraggs | 41:b7e86fa6dbb8 | 27 | } |
icraggs | 41:b7e86fa6dbb8 | 28 | #endif |
icraggs | 41:b7e86fa6dbb8 | 29 | #if !defined(ERROR) |
icraggs | 41:b7e86fa6dbb8 | 30 | #define ERROR(...) \ |
icraggs | 41:b7e86fa6dbb8 | 31 | { \ |
icraggs | 41:b7e86fa6dbb8 | 32 | fprintf(STREAM, "ERROR: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
icraggs | 41:b7e86fa6dbb8 | 33 | fprintf(STREAM, ##__VA_ARGS__); \ |
icraggs | 41:b7e86fa6dbb8 | 34 | fflush(STREAM); \ |
icraggs | 41:b7e86fa6dbb8 | 35 | exit(1); \ |
icraggs | 41:b7e86fa6dbb8 | 36 | } |
icraggs | 41:b7e86fa6dbb8 | 37 | #endif |
icraggs | 41:b7e86fa6dbb8 | 38 | |
icraggs | 41:b7e86fa6dbb8 | 39 | #endif |