log.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002  * @Brief     Log configuration for the dji2mav system. Only macros here
00003  * @Version   0.3.0
00004  * @Author    Chris Liu
00005  * @Created   2015/12/16
00006  * @Modified  2015/12/16
00007  *****************************************************************************/
00008 
00009 #ifndef _DJI2MAV_LOG_H_
00010 #define _DJI2MAV_LOG_H_
00011 
00012 
00013 #include <stdio.h>
00014 #include <stdlib.h>
00015 #include <string.h>
00016 #include <errno.h>
00017 
00018 #define _NO_LOG_FUNC(fmt, ...) \
00019         do{ } while(0)
00020 #define _FATAL_FUNC(fmt, ...) \
00021         do{ fprintf(stderr, "[dji2mav] [FATAL] " \
00022         "In file: %s, function: %s, line: %d. Errno: %s. " fmt "\n", \
00023         __FILE__, __func__, __LINE__, strerror(errno), ## __VA_ARGS__); \
00024         } while(0)
00025 #define _ERROR_FUNC(fmt, ...) \
00026         do{ fprintf(stderr, "[dji2mav] [ERROR] " \
00027         "In file: %s, function: %s, line: %d. Errno: %s. " fmt "\n", \
00028         __FILE__, __func__, __LINE__, strerror(errno), ## __VA_ARGS__); \
00029         } while(0)
00030 #define _WARN_FUNC(fmt, ...) \
00031         do{ fprintf(stdout, "[dji2mav] [WARN] " \
00032         "In file: %s, function: %s, line: %d. " fmt "\n", \
00033         __FILE__, __func__, __LINE__, ## __VA_ARGS__); } while(0)
00034 #define _INFO_FUNC(fmt, ...) \
00035         do{ fprintf(stdout, "[dji2mav] [INFO] " \
00036         fmt "\n", ## __VA_ARGS__); } while(0)
00037 #define _DEBUG_FUNC(fmt, ...) \
00038         do{ fprintf(stdout, "[dji2mav] [DEBUG] " \
00039         "%s, %s, %d: " fmt "\n", \
00040         __FILE__, __func__, __LINE__, ## __VA_ARGS__); } while(0)
00041 #define _TRACE_FUNC(fmt, ...) \
00042         do{ fprintf(stdout, "[dji2mav] [TRACE] " \
00043         "%s, %s, %d: " fmt "\n", \
00044         __FILE__, __func__, __LINE__, ## __VA_ARGS__); } while(0)
00045 
00046 #ifndef DJI2MAV_LOG_OFF
00047 #  define DJI2MAV_FATAL _FATAL_FUNC
00048 #  ifndef DJI2MAV_LOG_FATAL
00049 #    define DJI2MAV_ERROR _ERROR_FUNC
00050 #    ifndef DJI2MAV_LOG_ERROR
00051 #      define DJI2MAV_WARN _WARN_FUNC
00052 #      ifndef DJI2MAV_LOG_WARN
00053 #        define DJI2MAV_INFO _INFO_FUNC
00054 #        ifndef DJI2MAV_LOG_INFO
00055 #          define DJI2MAV_DEBUG _DEBUG_FUNC
00056 #          ifndef DJI2MAV_LOG_DEBUG
00057 #            define DJI2MAV_TRACE _TRACE_FUNC
00058 #          else
00059 #            define DJI2MAV_TRACE _NO_LOG_FUNC
00060 #          endif
00061 #        else
00062 #          define DJI2MAV_DEBUG _NO_LOG_FUNC
00063 #          define DJI2MAV_TRACE _NO_LOG_FUNC
00064 #        endif
00065 #      else
00066 #        define DJI2MAV_INFO _NO_LOG_FUNC
00067 #        define DJI2MAV_DEBUG _NO_LOG_FUNC
00068 #        define DJI2MAV_TRACE _NO_LOG_FUNC
00069 #      endif
00070 #    else
00071 #      define DJI2MAV_WARN _NO_LOG_FUNC
00072 #      define DJI2MAV_INFO _NO_LOG_FUNC
00073 #      define DJI2MAV_DEBUG _NO_LOG_FUNC
00074 #      define DJI2MAV_TRACE _NO_LOG_FUNC
00075 #    endif
00076 #  else
00077 #    define DJI2MAV_ERROR _NO_LOG_FUNC
00078 #    define DJI2MAV_WARN _NO_LOG_FUNC
00079 #    define DJI2MAV_INFO _NO_LOG_FUNC
00080 #    define DJI2MAV_DEBUG _NO_LOG_FUNC
00081 #    define DJI2MAV_TRACE _NO_LOG_FUNC
00082 #  endif
00083 #else
00084 #  define DJI2MAV_FATAL _NO_LOG_FUNC
00085 #  define DJI2MAV_ERROR _NO_LOG_FUNC
00086 #  define DJI2MAV_WARN _NO_LOG_FUNC
00087 #  define DJI2MAV_INFO _NO_LOG_FUNC
00088 #  define DJI2MAV_DEBUG _NO_LOG_FUNC
00089 #  define DJI2MAV_TRACE _NO_LOG_FUNC
00090 #endif
00091 
00092 
00093 #endif


dji_sdk_dji2mav
Author(s):
autogenerated on Thu Jun 6 2019 17:55:34