printf log信息调试宏定义

#ifndef __DEBUG_H__
#define __DEBUG_H__


#define LOG_LEVEL 0x01   //通过设置LOG_LEVEL可以设置调试以及取消打印语句,开发调试以及发产品


#define LEVEL_NONE 0x00
#define LEVEL_INFO 0x01
#define LEVEL_WARNING 0x02
#define LEVEL_ERROR 0x03


#if(LOG_LEVEL == LEVEL_NONE)
#define ALOGD(format,...)
#define ALOGW(format,...)
#define ALOGE(format,...)
#elif(LOG_LEVEL == LEVEL_INFO)
#define ALOGD(format,...) printf("\n[Log Info] [File:%s, Line:%d] "format"\n", __FILE__, __LINE__, ##__VA_ARGS__)
#define ALOGW(format,...) printf("\n[Log Warning] [File:%s, Line:%d] "format"\n", __FILE__, __LINE__, ##__VA_ARGS__)
#define ALOGE(format,...) printf("\n[Log Error] [File:%s, Line:%d] "format"\n", __FILE__, __LINE__, ##__VA_ARGS__)
#elif(LOG_LEVEL == LEVEL_WARNING)
#define ALOGD(format,...)
#define ALOGW(format,...) printf("\n[Log Warning] [File:%s, Line:%d] "format"\n", __FILE__, __LINE__, ##__VA_ARGS__)
#define ALOGE(format,...) printf("\n[Log Error] [File:%s, Line:%d] "format"\n", __FILE__, __LINE__, ##__VA_ARGS__)
#elif(LOG_LEVEL == LEVEL_ERROR)
#define ALOGD(format,...)
#define ALOGW(format,...)
#define ALOGE(format,...) printf("\n[Log Error] [File:%s, Line:%d] "format"\n", __FILE__, __LINE__, ##__VA_ARGS__)
#endif


#endif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值