debug 进行 模板打印

1、可用如下

#ifndef _DEBUG_SET_

#define debug_print(format, ...) {fprintf(stderr, "[Libiot_ETH][%s, %s(), L:%d] > " format "\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__ );}

#endif



`

2、stderr的解释:

相对于stdout,当设定标准输出为到文件等情况时,stderr选项保证fprintf依旧串口输出到屏幕


3、关于

##__VA_ARGS__

#、##、__VA_ARGS__的使用 - auccy的博客 - CSDN博客 https://blog.csdn.net/auccy/article/details/88833659

宏的高级使用–##,VA_ARGSFILE, __FUNCTION__等 - yiya1989的专栏 - CSDN博客 https://blog.csdn.net/yiya1989/article/details/7849588


`
``

`

4、注意空格问题

C++11 error: unable to find string literal operator 'operator" - nh5431313的专栏 - CSDN博客 https://blog.csdn.net/nh5431313/article/details/78753597

5、PS

Debug格式化输出----基于C语言 - micro虾米 - 博客园
https://www.cnblogs.com/microxiami/p/8027001.html

格式化输出syslog简易实现 - hancq - 博客园
https://www.cnblogs.com/hancq/p/5408317.html

Debug格式化输出----基于C语言 - micro虾米 - 博客园
https://www.cnblogs.com/microxiami/p/8027001.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值