#ifndef _THIS_FUNC_
#define _THIS_FUNC_ __FUNCTION__
#endif
#define _ab_dump(format,prefix,out,...) \
fprintf(out,"%s %s, %ld : "format"\n",prefix, __FILE__, __LINE__, ##__VA_ARGS__)
#define ab_stderr(format,prefix,...) _ab_dump(format,prefix,stderr, ##__VA_ARGS__)
#define ab_perr(format,...) ab_stderr(format,"ERR",##__VA_ARGS__)
#define _ab_logx(format,prefix,...) _ab_dump(format,prefix,stdout, ##__VA_ARGS__)
#define ab_log(format,...) _ab_logx(format,"", ##__VA_ARGS__)
#define ab_dbg(format,...) _ab_logx(format,"DBG", ##__VA_ARGS__)
#define ab_err(format,...) _ab_logx(format,"ERR", ##__VA_ARGS__)
#define AB_INVOKE_FUNC(...) _ab_logx("call function { %s } .","FLW", ##__VA_ARGS__)
#define AB_INVOKE_BEGIN _ab_logx("Invoke %s begin.","FLW", _THIS_FUNC_);
#define AB_INVOKE_END _ab_logx("Invoke %s end.","FLW", _THIS_FUNC_);
#define AB_INVOKE_ENDX(...) _ab_logx("Invoke %s end with return %d !","FLW", _THIS_FUNC_, ##__VA_ARGS__)
【编程-C】日志打印宏的定义与提示
最新推荐文章于 2024-02-02 12:00:00 发布