#define __TIME_ struct timeval tv; struct tm *ptm;gettimeofday(&tv, NULL);ptm = localtime(&tv.tv_sec);
#define __TIME_MS__ ptm->tm_year + 1900,ptm->tm_mon + 1,ptm->tm_mday,ptm->tm_hour,ptm->tm_min,ptm->tm_sec,tv.tv_usec
#define debug_printf(fmt,...) do{__TIME_; printf("debug: [time:%d-%02d-%02d %02d:%02d:%02d.%d,file:%s line:%d] " fmt ,__TIME_MS__,__FILE__,__LINE__,##__VA_ARGS__);}while(0)
#define error_printf(fmt,...) do{ __TIME_; printf("error: [time:%d-%02d-%02d %02d:%02d:%02d.%d,file:%s line:%d] " fmt ,__TIME_MS__,__FILE__,__LINE__,##__VA_ARGS__);}while(0)
printf 封装打印
于 2022-03-07 15:02:21 首次发布