Fork of my original MQTTGateway

Dependencies:   mbed-http

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fsfat_debug.h Source File

fsfat_debug.h

Go to the documentation of this file.
00001 /** @file fsfat_debug.h
00002  *
00003  * component debug header file.
00004  */
00005 
00006 
00007 #ifndef __FSFAT_DEBUG
00008 #define __FSFAT_DEBUG
00009 
00010 #include <stdint.h>
00011 #include <assert.h>
00012 #include <stdio.h>
00013 
00014 
00015 /* Debug Support */
00016 
00017 #define FSFAT_LOG_NONE        0
00018 #define FSFAT_LOG_ERR         1
00019 #define FSFAT_LOG_WARN        2
00020 #define FSFAT_LOG_NOTICE      3
00021 #define FSFAT_LOG_INFO        4
00022 #define FSFAT_LOG_DEBUG       5
00023 #define FSFAT_LOG_FENTRY      6
00024 
00025 #define FSFAT_LOG(_fmt, ...)                          \
00026   do                                                    \
00027   {                                                     \
00028         printf(_fmt, __VA_ARGS__);                      \
00029   }while(0);
00030 
00031 #define noFSFAT_DEBUG
00032 #ifdef FSFAT_DEBUG
00033 
00034 extern uint32_t fsfat_optDebug_g;
00035 extern uint32_t fsfat_optLogLevel_g;
00036 
00037 
00038 /* uncomment for asserts to work */
00039 /* #undef NDEBUG */
00040 // todo: port to mbedOSV3++ #include <core-util/assert.h>
00041 
00042 #define FSFAT_INLINE
00043 // todo: port to mbedOSV3++ #define FSFAT_ASSERT  CORE_UTIL_ASSERT
00044 #define FSFAT_ASSERT(...)
00045 
00046 #define FSFAT_DBGLOG(_fmt, ...)                       \
00047   do                                                    \
00048   {                                                     \
00049     if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_DEBUG))  \
00050     {                                                   \
00051         printf(_fmt, __VA_ARGS__);                      \
00052     }                                                   \
00053   }while(0);
00054 
00055 
00056 #define FSFAT_ERRLOG(_fmt, ...)                       \
00057   do                                                    \
00058   {                                                     \
00059     if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_ERR))  \
00060     {                                                   \
00061         printf(_fmt, __VA_ARGS__);                      \
00062     }                                                   \
00063   }while(0);
00064 
00065 
00066 #define FSFAT_FENTRYLOG(_fmt, ...)                       \
00067   do                                                    \
00068   {                                                     \
00069     if(fsfat_optDebug_g && (fsfat_optLogLevel_g >= FSFAT_LOG_FENTRY))  \
00070     {                                                   \
00071         printf(_fmt, __VA_ARGS__);                      \
00072     }                                                   \
00073   }while(0);
00074 
00075 
00076 
00077 
00078 
00079 #else
00080 #define FSFAT_ASSERT(_x)                   do { } while(0)
00081 #define FSFAT_INLINE                       inline
00082 #define FSFAT_DBGLOG(_fmt, ...)            do { } while(0)
00083 #define FSFAT_ERRLOG(_fmt, ...)            do { } while(0)
00084 #define FSFAT_FENTRYLOG(_fmt, ...)         do { } while(0)
00085 #endif /* FSFAT_DEBUG */
00086 
00087 
00088 #endif /*__FSFAT_DEBUG*/