#include <stdio.h>
#include <stdarg.h>
#define DEBUG
#ifdef DEBUG
#define LOG(format, ...) \
my_printf(format, __VA_ARGS__)
#define LOG_A(format, args...) \
my_printf(format, args)
#define LOG_B(format, ...) \
my_printf("func:%s,time:%u " format, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOG_C(format, args...) \
my_printf(format, ##args)
#else
#endif
#define LOG_PRINT(...) \
printf(__VA_ARGS__)
int var_arg(const char *format, const char *funcName, int line, ...)
{
char buff[4096] = {0};
printf("format %s\n funcname %s fun\n line %d\n", format, funcName, line);
va_list args;
va_start(args, line);
vsnprintf(buff, sizeof(buff), format, args);
va_end(args);
printf("va_args: %s\n", buff);
}
void my_printf(const char *format, ...)
{
char buff[4096] = {0};
va_list args;
va_start(args, format);
vsnprintf(buff, sizeof(buff), format, args);
va_end(args);
printf("my_print: %s\n", buff);
}
int main()
{
return 0;
}
|