版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010164190/article/details/85119264
1.printf()自定义函数
#define DEBUG
#define LOG_TAG "MIC_DEBUG"
#ifdef DEBUG
#include <stdio.h>
#define debug(fmt, x...) printf("%s: %s() line: %d "fmt, LOG_TAG, __FUNCTION__, __LINE__, ##x);
#else
#define debug(fmt, x...)
#endif
int main()
{
int num = 4567;
debug("num = %d\n", num);
}
2.printk()自定义函数
1、定义
#define LOG_TAG "[Camera]: %s() line: %d "
#define Camera_ERR(fmt, args...) printk(KERN_ERR LOG_TAG fmt, __FUNCTION__, __LINE__, ##args)
2、打印函数
void test(){
Camera_ERR("%s\n", __func__);
}
3、输出log为:
[Camera] test