#define定义 printf实现log的打印`

##define定义 printf实现log的打印

/*
    如果需要打印调试信息 
    #define DEBUG_LOG_EN x
                         0/关闭所有调试信息 
                         1/只打开最高级 
                         2/打开高和中级 
                         3/全部打开
    LOG()                低级
    LOG_MID()            中级
    LOG_HIGH()           高级
    如果需要在某个文件中使用不同的显示等级,
    在那个c文件的最开头(包含debug头文件之前)
    定义DEBUG_LOG_EN的等级。
    默认显示等级可以在下面设置
*/
#ifndef DEBUG_LOG_EN
    #define DEBUG_LOG_EN 0 //设置默认显示等级
#endif

#if (DEBUG_LOG_EN==1)
    #define DEBUG_LOG_EN_HIGH
#endif
#if (DEBUG_LOG_EN==2)
    #define DEBUG_LOG_EN_HIGH
    #define DEBUG_LOG_EN_MID
#endif
#if (DEBUG_LOG_EN==3)
    #define DEBUG_LOG_EN_HIGH
    #define DEBUG_LOG_EN_MID
    #define DEBUG_LOG_EN_LOW
#endif

#ifdef  DEBUG_LOG_EN_LOW
    #define LOG(format,args...)    printf(format,##args)
#else   
    #define LOG(format,args...)     ((void)0)
#endif

#ifdef  DEBUG_LOG_EN_MID
    #define LOG_MID(format,args...)    printf(format,##args)
#else   
    #define LOG_MID(format,args...)    ((void)0)
#endif

#ifdef  DEBUG_LOG_EN_HIGH
    #define LOG_HIGH(format,args...)    printf(format,##args)
#else   
    #define LOG_HIGH(format,args...)    ((void)0)
#endif    
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值