1 | /*****************************************************/ |
---|
2 | /* this file is part of the tiTan / tiTanNIT Project */ |
---|
3 | /* and allowed only for use with this. */ |
---|
4 | /* */ |
---|
5 | /* copyright by NIT */ |
---|
6 | /*****************************************************/ |
---|
7 | |
---|
8 | #ifndef DEBUG_H |
---|
9 | #define DEBUG_H |
---|
10 | |
---|
11 | short debug_level = 10; |
---|
12 | |
---|
13 | // mc debug_level = 50; |
---|
14 | // panel debug_level = 60; |
---|
15 | |
---|
16 | //first line shows greater/same debuglevel |
---|
17 | //second line shows only same debuglevel |
---|
18 | //#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__); } |
---|
19 | #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__); } |
---|
20 | |
---|
21 | #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__); } |
---|
22 | |
---|
23 | #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__); } |
---|
24 | |
---|
25 | #endif |
---|