Jack Hansdampf
/
MQTT_HelloENC28J60
MQTT client to test the ENC28J60-EMAC on NUCLEO-L152RE
MQTT/MQTTLogging.h@6:c123d9b8e6f4, 2021-08-20 (annotated)
- Committer:
- jack1930
- Date:
- Fri Aug 20 11:02:55 2021 +0000
- Revision:
- 6:c123d9b8e6f4
- Parent:
- 0:238f0d0c0ba3
Angepasst fuer GSOE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:238f0d0c0ba3 | 1 | #if !defined(MQTT_LOGGING_H) |
hudakz | 0:238f0d0c0ba3 | 2 | #define MQTT_LOGGING_H |
hudakz | 0:238f0d0c0ba3 | 3 | |
hudakz | 0:238f0d0c0ba3 | 4 | #define STREAM stdout |
hudakz | 0:238f0d0c0ba3 | 5 | #if !defined(DEBUG) |
hudakz | 0:238f0d0c0ba3 | 6 | #define DEBUG(...) \ |
hudakz | 0:238f0d0c0ba3 | 7 | {\ |
hudakz | 0:238f0d0c0ba3 | 8 | fprintf(STREAM, "DEBUG: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
hudakz | 0:238f0d0c0ba3 | 9 | fprintf(STREAM, ##__VA_ARGS__); \ |
hudakz | 0:238f0d0c0ba3 | 10 | fflush(STREAM); \ |
hudakz | 0:238f0d0c0ba3 | 11 | } |
hudakz | 0:238f0d0c0ba3 | 12 | #endif |
hudakz | 0:238f0d0c0ba3 | 13 | #if !defined(LOG) |
hudakz | 0:238f0d0c0ba3 | 14 | #define LOG(...) \ |
hudakz | 0:238f0d0c0ba3 | 15 | {\ |
hudakz | 0:238f0d0c0ba3 | 16 | fprintf(STREAM, "LOG: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
hudakz | 0:238f0d0c0ba3 | 17 | fprintf(STREAM, ##__VA_ARGS__); \ |
hudakz | 0:238f0d0c0ba3 | 18 | fflush(STREAM); \ |
hudakz | 0:238f0d0c0ba3 | 19 | } |
hudakz | 0:238f0d0c0ba3 | 20 | #endif |
hudakz | 0:238f0d0c0ba3 | 21 | #if !defined(WARN) |
hudakz | 0:238f0d0c0ba3 | 22 | #define WARN(...) \ |
hudakz | 0:238f0d0c0ba3 | 23 | { \ |
hudakz | 0:238f0d0c0ba3 | 24 | fprintf(STREAM, "WARN: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
hudakz | 0:238f0d0c0ba3 | 25 | fprintf(STREAM, ##__VA_ARGS__); \ |
hudakz | 0:238f0d0c0ba3 | 26 | fflush(STREAM); \ |
hudakz | 0:238f0d0c0ba3 | 27 | } |
hudakz | 0:238f0d0c0ba3 | 28 | #endif |
hudakz | 0:238f0d0c0ba3 | 29 | #if !defined(ERROR) |
hudakz | 0:238f0d0c0ba3 | 30 | #define ERROR(...) \ |
hudakz | 0:238f0d0c0ba3 | 31 | { \ |
hudakz | 0:238f0d0c0ba3 | 32 | fprintf(STREAM, "ERROR: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \ |
hudakz | 0:238f0d0c0ba3 | 33 | fprintf(STREAM, ##__VA_ARGS__); \ |
hudakz | 0:238f0d0c0ba3 | 34 | fflush(STREAM); \ |
hudakz | 0:238f0d0c0ba3 | 35 | exit(1); \ |
hudakz | 0:238f0d0c0ba3 | 36 | } |
hudakz | 0:238f0d0c0ba3 | 37 | #endif |
hudakz | 0:238f0d0c0ba3 | 38 | |
hudakz | 0:238f0d0c0ba3 | 39 | #endif |