1 | #ifndef DEBUG_H |
---|
2 | #define DEBUG_H |
---|
3 | |
---|
4 | short debug_level = 10; |
---|
5 | |
---|
6 | // mc debug_level = 50; |
---|
7 | // panel debug_level = 60; |
---|
8 | |
---|
9 | //first line shows greater/same debuglevel |
---|
10 | //second line shows only same debuglevel |
---|
11 | //#define debug(level, fmt, args...) if(debug_level >= level) { do { printf("[%s] " fmt, PROGNAME, ##args); } while (0); printf(", file=%s, func=%s, line=%d\n", __FILE__, __FUNCTION__, __LINE__); } |
---|
12 | #define debug(level, fmt, args...) if(debug_level == level) { do { printf("[%s] " fmt, PROGNAME, ##args); } while (0); printf(", file=%s, func=%s, line=%d\n", __FILE__, __FUNCTION__, __LINE__); } |
---|
13 | |
---|
14 | #define err(fmt, args...) { do { fprintf(stderr, "[%s] error: " fmt, PROGNAME, ##args); } while (0); fprintf(stderr, ", file=%s, func=%s, line=%d\n", __FILE__, __FUNCTION__, __LINE__); } |
---|
15 | |
---|
16 | #define perr(fmt, args...) { do { fprintf(stderr, "[%s] error: " fmt, PROGNAME, ##args); } while (0); fprintf(stderr, ", err=%m, file=%s, func=%s, line=%d\n", __FILE__, __FUNCTION__, __LINE__); } |
---|
17 | |
---|
18 | #endif |
---|