40 #define MAX_PATH_LEN 128 43 #define PRINT_DEBUG(format, ...) \ 44 PRINT_DEBUG_LVL(0, format, ##__VA_ARGS__) 46 #define PRINT_DEBUG_LVL(level, format, ...) \ 47 if (DEBUG) PRINT_MESSAGE(level, format, "DEBUG", ##__VA_ARGS__) 49 #define PRINT_ERROR(format, ...) \ 50 PRINT_MESSAGE(0, format, "ERROR", ##__VA_ARGS__) 52 #define PRINT_MESSAGE(level, format, type, ...) \ 53 if (level <= MSG_LVL) \ 54 printf("[%s|%s:%s] " format, type, \ 55 strrchr(__FILE__, '/') + 1, \ 56 __FUNCTION__, ##__VA_ARGS__);