52381ad0e5fc454bf0218831acbb6add40fafc13
1 /* Logging facilities */
4 * Macros, all printf style:
6 * ERR(...), ERROR(...) - Always printed, errcount is incremented.
7 * WARN(...), WARNING(...) - Printed if verbosity_level>0
8 * MSG(...), MESSAGE(...), INFO(...) - Printed if verbosity_level>1
9 * DBG(...), DEBUG(...) - Printed if verbosity_level>2
11 * Default verbosity level is 1, warnings and errors displayed.
19 /* Global variable containing the program's runtime verbosity level */
20 extern int verbosity_level
;
22 /* Global variable containing the program's error count */
23 extern int error_count
;
25 /* Global variable containing the program's warning count */
26 extern int warn_count
;
28 /* Global variable containing the program's message count */
31 /* Show the log summary */
32 extern void log_summary();
34 /* Exit program with logging summary */
35 void exit_program(int status
);
38 fprintf(stderr," ERROR: " __VA_ARGS__); \
42 #define ERR(...) ERROR(__VA_ARGS__)
44 #define WARNING(...){ \
45 if (verbosity_level>0) fprintf(stderr,"WARNING: " __VA_ARGS__); \
49 #define WARN(...) WARNING(__VA_ARGS__)
52 if (verbosity_level>1) fprintf(stderr, " INFO: " __VA_ARGS__); \
56 #define MESSAGE(...) INFO(__VA_ARGS__)
58 #define MSG(...) MESSAGE(__VA_ARGS__)
61 if (verbosity_level>2) fprintf(stderr," DEBUG: " __VA_ARGS__);\
63 #define DBG(...) DEBUG(__VA_ARGS__)