USE YHTANG AWS ACCOUNT TO TEST MQTT
Dependents: NuMaker-mbed-AWS-IoT-example
MQTTLogging.h@63:c57413ad5e75, 2020-12-01 (annotated)
- Committer:
- doudoutang
- Date:
- Tue Dec 01 03:25:29 2020 +0000
- Revision:
- 63:c57413ad5e75
- Parent:
- 43:21da1f744243
no change
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 |