An API for using MQTT over multiple transports

Dependencies:   FP MQTTPacket

Fork of MQTT by MQTT

Committer:
icraggs
Date:
Mon Sep 29 11:34:26 2014 +0000
Revision:
43:21da1f744243
Parent:
MQTT_logging.h@41:b7e86fa6dbb8
QoS 2 processing

Who changed what in which revision?

UserRevisionLine numberNew 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