/******************************************************************************
版权所有 (C) 2014
******************************************************************************
文 件 名 : debug.h
版 本 号 : 初稿
作 者 : zhj2232006
生成日期 : 2014年10月8日
最近修改 :
功能描述 : debug.h 的头文件, DEBUG_LEVEL 需根据需要设置值。
此文件包含 PRINTD 宏,用法:
PRINTD(...),与 printf函数类似,但不需要再加换行符 。
define DEBUG_LEVEL 3 打印文件名、行号、函数名称和自定义内容
define DEBUG_LEVEL 2 打印函数名称和自定义内容
define DEBUG_LEVEL 1 仅打印自定义内容
define DEBUG_LEVEL 0 对 printf 函数无调用,无任何打印信息。
函数列表 :
修改历史 :
******************************************************************************/
#ifndef __DEBUG_H__
#define __DEBUG_H__
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */
#define DEBUG_LEVEL 2
/*
#define DEBUG
#ifdef DEBUG
#define DEBUG_LEVEL 1
#else
#define DEBUG_LEVEL 0
#endif
*/
#if DEBUG_LEVEL >= 1
#define DEBUG
#else
#undef DEBUG
#endif
#if DEBUG_LEVEL == 3
#define PRINTD(format, ...) printf("[DBG]File: %s, Line: %d, Function: %s()" format "\r\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#elif DEBUG_LEVEL == 2
#define PRINTD(format, ...) printf("[DBG]Function: %s()" format "\r\n", __FUNCTION__, ##__VA_ARGS__)
#elif DEBUG_LEVEL == 1
#define PRINTD(format, ...) printf(format "\r\n", ##__VA_ARGS__)
#elif DEBUG_LEVEL == 0
#define PRINTD(...)
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */
#endif /* __DEBUG_H__ */
版权所有 (C) 2014
******************************************************************************
文 件 名 : debug.h
版 本 号 : 初稿
作 者 : zhj2232006
生成日期 : 2014年10月8日
最近修改 :
功能描述 : debug.h 的头文件, DEBUG_LEVEL 需根据需要设置值。
此文件包含 PRINTD 宏,用法:
PRINTD(...),与 printf函数类似,但不需要再加换行符 。
define DEBUG_LEVEL 3 打印文件名、行号、函数名称和自定义内容
define DEBUG_LEVEL 2 打印函数名称和自定义内容
define DEBUG_LEVEL 1 仅打印自定义内容
define DEBUG_LEVEL 0 对 printf 函数无调用,无任何打印信息。
函数列表 :
修改历史 :
******************************************************************************/
#ifndef __DEBUG_H__
#define __DEBUG_H__
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */
#define DEBUG_LEVEL 2
/*
#define DEBUG
#ifdef DEBUG
#define DEBUG_LEVEL 1
#else
#define DEBUG_LEVEL 0
#endif
*/
#if DEBUG_LEVEL >= 1
#define DEBUG
#else
#undef DEBUG
#endif
#if DEBUG_LEVEL == 3
#define PRINTD(format, ...) printf("[DBG]File: %s, Line: %d, Function: %s()" format "\r\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#elif DEBUG_LEVEL == 2
#define PRINTD(format, ...) printf("[DBG]Function: %s()" format "\r\n", __FUNCTION__, ##__VA_ARGS__)
#elif DEBUG_LEVEL == 1
#define PRINTD(format, ...) printf(format "\r\n", ##__VA_ARGS__)
#elif DEBUG_LEVEL == 0
#define PRINTD(...)
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */
#endif /* __DEBUG_H__ */