Mercurial > rcctl_linux
annotate debug.h @ 11:1ee15e2dc386 default tip
added support for macosx
| author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
|---|---|
| date | Fri, 30 Nov 2012 22:10:10 +0900 |
| parents | 37e662c427a1 |
| children |
| rev | line source |
|---|---|
| 2 | 1 #ifndef __RCCTL_DEBUG_H__ |
| 2 #define __RCCTL_DEBUG_H__ | |
| 3 | |
| 4 extern int debug; | |
| 5 | |
| 6 /* print debug message if specified level is greater enough */ | |
| 7 #define debug(level, fmt, ...) \ | |
| 8 do { \ | |
| 9 if(debug >= level) { \ | |
| 10 fprintf(stderr, "%s: %s():%4d: " fmt, __FILE__, __FUNCTION__, (int) __LINE__, ## __VA_ARGS__); \ | |
| 11 } \ | |
| 12 } while(0); | |
| 13 | |
| 5 | 14 #define message(level, fmt, ...) \ |
| 15 do { \ | |
| 16 if(debug >= level) { \ | |
| 17 fprintf(stderr, fmt, ## __VA_ARGS__); \ | |
| 18 } \ | |
| 19 } while(0); | |
| 20 | |
| 2 | 21 #endif |
