The Cayenne MQTT mbed Library provides functions to easily connect to the Cayenne IoT project builder.

Dependents:   Cayenne-ESP8266Interface Cayenne-WIZnet_Library Cayenne-WIZnetInterface Cayenne-X-NUCLEO-IDW01M1 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MQTTLogging.h Source File

MQTTLogging.h

00001 /*******************************************************************************
00002  * Copyright (c) 2014 IBM Corp.
00003  *
00004  * All rights reserved. This program and the accompanying materials
00005  * are made available under the terms of the Eclipse Public License v1.0
00006  * and Eclipse Distribution License v1.0 which accompany this distribution.
00007  *
00008  * The Eclipse Public License is available at
00009  *    http://www.eclipse.org/legal/epl-v10.html
00010  * and the Eclipse Distribution License is available at
00011  *   http://www.eclipse.org/org/documents/edl-v10.php.
00012  *
00013  * Contributors:
00014  *    Ian Craggs - initial API and implementation and/or initial documentation
00015  *******************************************************************************/
00016 
00017 #if !defined(MQTT_LOGGING_H)
00018 #define MQTT_LOGGING_H
00019 
00020 #define STREAM      stdout
00021 #if !defined(DEBUG)
00022 #define DEBUG(...)    \
00023     {\
00024     fprintf(STREAM, "DEBUG:   %s L#%d ", __PRETTY_FUNCTION__, __LINE__);  \
00025     fprintf(STREAM, ##__VA_ARGS__); \
00026     fflush(STREAM); \
00027     }
00028 #endif
00029 #if !defined(LOG)
00030 #define LOG(...)    \
00031     {\
00032     fprintf(STREAM, "LOG:   %s L#%d ", __PRETTY_FUNCTION__, __LINE__);  \
00033     fprintf(STREAM, ##__VA_ARGS__); \
00034     fflush(STREAM); \
00035     }
00036 #endif
00037 #if !defined(WARN)
00038 #define WARN(...)   \
00039     { \
00040     fprintf(STREAM, "WARN:  %s L#%d ", __PRETTY_FUNCTION__, __LINE__);  \
00041     fprintf(STREAM, ##__VA_ARGS__); \
00042     fflush(STREAM); \
00043     }
00044 #endif 
00045 #if !defined(ERROR)
00046 #define ERROR(...)  \
00047     { \
00048     fprintf(STREAM, "ERROR: %s L#%d ", __PRETTY_FUNCTION__, __LINE__); \
00049     fprintf(STREAM, ##__VA_ARGS__); \
00050     fflush(STREAM); \
00051     exit(1); \
00052     }
00053 #endif
00054 
00055 #endif