An API for using MQTT over multiple transports

Dependencies:   FP MQTTPacket

Dependents:   Cellular_HelloMQTT IoTStarterKit GSwifiInterface_HelloMQTT IBMIoTClientEthernetExample ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MQTTLogging.h Source File

MQTTLogging.h

00001 #if !defined(MQTT_LOGGING_H)
00002 #define MQTT_LOGGING_H
00003 
00004 #define STREAM      stdout
00005 #if !defined(DEBUG)
00006 #define DEBUG(...)    \
00007     {\
00008     fprintf(STREAM, "DEBUG:   %s L#%d ", __PRETTY_FUNCTION__, __LINE__);  \
00009     fprintf(STREAM, ##__VA_ARGS__); \
00010     fflush(STREAM); \
00011     }
00012 #endif
00013 #if !defined(LOG)
00014 #define LOG(...)    \
00015     {\
00016     fprintf(STREAM, "LOG:   %s L#%d ", __PRETTY_FUNCTION__, __LINE__);  \
00017     fprintf(STREAM, ##__VA_ARGS__); \
00018     fflush(STREAM); \
00019     }
00020 #endif
00021 #if !defined(WARN)
00022 #define WARN(...)   \
00023     { \
00024     fprintf(STREAM, "WARN:  %s L#%d ", __PRETTY_FUNCTION__, __LINE__);  \
00025     fprintf(STREAM, ##__VA_ARGS__); \
00026     fflush(STREAM); \
00027     }
00028 #endif 
00029 #if !defined(ERROR)
00030 #define ERROR(...)  \
00031     { \
00032     fprintf(STREAM, "ERROR: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
00033     fprintf(STREAM, ##__VA_ARGS__); \
00034     fflush(STREAM); \
00035     exit(1); \
00036     }
00037 #endif
00038 
00039 #endif