当前位置:网站首页>C language: use macro to redefine printf and print [debug debugging information]
C language: use macro to redefine printf and print [debug debugging information]
2022-07-18 07:14:00 【Old_ Driver_ Lee】
List of articles
One 、common.h
/* * DEBUG Debugging information : * Use :DEBUG_ERROR_POSITION, Print the current error code line 、 file name 、 Function name * The function starts with :DEBUG_FUNC_START, Print the function name start, Prompt function start * The internal end of the function uses :DEBUG_FUNC_END, Print the function name end, Prompt function end */
#ifdef DEBUG
#define DEBUG_ERROR_POSITION printf("Error:[file %s],[line %d],[function %s]\r\n", __FILE__, __LINE__, __func__)
#define DEBUG_FUNC_START printf("FUNC:[ %s ] start!\r\n", __func__)
#define DEBUG_FUNC_END printf("FUNC:[ %s ] end!\r\n", __func__)
#else
#define DEBUG_ERROR_POSITION
#define DEBUG_FUNC_START
#define DEBUG_FUNC_END
#endif
/* * DEBUG Debugging information : * Use :DEBUG_INFO(), Print debugging log */
#ifdef DEBUG
#define DEBUG_INFO(format, ...) printf(format, ##__VA_ARGS__)
#else
#define DEBUG_INFO(format, ...)
#endif
/* * DEBUG Debugging information : * Use in a function :DEBUG_FUNC(), Print function related debugging log */
#ifdef DEBUG
#define DEBUG_FUNC(format, ...) printf(format, ##__VA_ARGS__)
#else
#define DEBUG_FUNC(format, ...)
#endif
/* * Log: * User interaction LOG */
#define LOG printf
边栏推荐
- Using chardet to detect web page coding
- 编程练习
- 60 year old developer's suggestion, try to change it!
- ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the
- TP5的whereOr方法多条件存在
- flowable 自定义属性实现和属性获取小记
- 【森城市】GIS数据漫谈(四)— 坐标系统
- 解决${pageContext.request.contextPath }无效问题
- ASP.NET里的Session详细解释
- Private cloud ranking of Tangmen concealed weapons
猜你喜欢

MAZAK手轮维修马扎克小巨人数控机床手柄操作器维修AV-EAHS-382-1

Is there a limit on the length of string? How much is it?

Enumeration, do you know it?

H264 decoding sequence display sequence reference sequence

抽丝剥茧C语言(高阶)静态通讯录

编程练习

Based on taskscheduler and crontask, realize the function of dynamically adding and deleting scheduled tasks
![Centernet (objects as points) [based on tf.slim]](/img/57/9906d367938a6698dc02e026eb61b8.png)
Centernet (objects as points) [based on tf.slim]

根据verilog代码画电路图

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the
随机推荐
左旋转字符串
9. MySQL -- getting started with JDBC
浅析PHP关键词替换的类(避免重复替换,保留与还原原始链接)
Writing PHP form data to MySQL code
Insert any element at the specified position in the array and delete the element with value x in the array
Cron表达式使用
Detailed explanation of time complexity and space complexity
When the decimal places are reserved, there may be a simple solution without rounding
Rhcsa note 2
AB website stress test
产品-Axure9英文版,使用Repeater中继器实现下拉多选框
Compileflow Taobao Workflow Engine
Debug system
MODBUS-RS485布线的8条准则
Design and implementation of fingertip Roulette Games (uniapp implements wechat applet)
头文件里面的ifndef /define/endif的作用
Lenovo Power Management Download
每日一题:数组中最大数对和的最小值(LeeCode)
ITSM确保IT服务台敏捷性的5大实践
8. MySQL -- 触发器