#ifdef DEBUG
#define ASSERT(exp) \
do { \
if (!(exp)) { \
fprintf(stderr, "[ASSERT!][%s:%s:%d]: %s\n", \
__FILE__, __FUNCTION__, __LINE__, #exp); \
abort(); \
} \
} while (0)
#define ERROR(...) \
{ \
fprintf(stderr, "[ERROR ][%s:%s:%d] ", \
__FILE__, __FUNCTION__, __LINE__); \
fprintf(stderr, __VA_ARGS__); \
}
#define WARNING(...) \
{ \
fprintf(stderr, "[WARNING][%s:%s:%d] ", \
__FILE__, __FUNCTION__, __LINE__); \
fprintf(stderr, __VA_ARGS__); \
}
#define INFO(...) \
{ \
fprintf(stdout, "[INFO ][%s:%s:%d] ", \
__FILE__, __FUNCTION__, __LINE__); \
fprintf(stdout, __VA_ARGS__); \
}
#else
#define ASSERT(exp)
#define ERROR(...)
#define WARNING(...)
#define INFO(...)
#endif
阅读(2675) | 评论(0) | 转发(0) |