#ifndef MYLOG_H #define MYLOG_H #include <stdio.h> #define __DEBUG__ #ifdef __DEBUG__ #define DEBUG(format,...) printf("File: "__FILE__", Line: %d: "format"\n", __LINE__, ##__VA_ARGS__) #define detail(format, args...) printf("debug[%s|%s|%d]/t"format"\n",__FILE__,__func__,__LINE__,##args) #define info(format, args...) printf("info[%s|%s|%d]/t"format"\n",__FILE__,__func__,__LINE__,##args) #define warn(format, args...) printf("warn[%s|%s|%d]/t"format"\n",__FILE__,__func__,__LINE__,##args) #define error(format, args...) printf("error[%s|%s|%d]/t"format"\n",__FILE__,__func__,__LINE__,##args) #else #define DEBUG(format,...) #define detail(format, args...) #define info(format, args...) #define warn(format, args...) #define error(format, args...) #endif #endif #include <iostream> using namespace std; int main() { string straab = "asdf"; DEBUG("aaa-%s",straab.c_str()); return 0; }
原文链接: https://www.cnblogs.com/mingyue605/p/10982259.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/296242
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!