macro
#include<iostream>
using namespace std;
#define LOG(str) printf("[%s][%s](%d)[%s][%s]:%s",__FILE__, __func__, __LINE__,__DATE__, __TIME__, str)
int main()
{
LOG("log");
return 0;
}
macro log
#include <stdio.h>
#define LOG_DEBUG "DEBUG"
#define LOG_TRACE "TRACE"
#define LOG_ERROR "ERROR"
#define LOG_INFO "INFOR"
#define LOG_CRIT "CRTCL"
#define LOG(level, format, ...) \
do { \
fprintf(stderr, "[%s|%s@%s:%d] " format "\n", \
level, __func__, __FILE__, __LINE__, ##__VA_ARGS__ ); \
} while (0)
int main()
{
LOG(LOG_DEBUG, "a=%d,b=%d,c=%s", 10,20,"end");
return 0;
}