--- /dev/null
+/* Logging facilities */
+
+/*
+ * Macros, all printf style:
+ *
+ * ERR(...), ERROR(...) - Always printed, errcount is incremented.
+ * WARN(...), WARNING(...) - Printed if verbosity_level>0
+ * MSG(...), MESSAGE(...), INFO(...) - Printed if verbosity_level>1
+ * DBG(...), DEBUG(...) - Printed if verbosity_level>2
+ *
+ * Default verbosity level is 1, warnings and errors displayed.
+ */
+
+#ifndef LOGGING_H
+#define LOGGING_H
+
+#include <stdio.h>
+
+/* Global variable containing the program's runtime verbosity level */
+extern int verbosity_level;
+
+/* Global variable containing the program's error count */
+extern int error_count;
+
+/* Global variable containing the program's warning count */
+extern int warn_count;
+
+/* Global variable containing the program's message count */
+extern int msg_count;
+
+/* Show the log summary */
+extern void log_summary();
+
+/* Exit program with logging summary */
+void exit_program(int status);
+
+#define ERROR(...){ \
+ fprintf(stderr," ERROR: " __VA_ARGS__); \
+ error_count++; \
+ }
+
+#define ERR(...) ERROR(__VA_ARGS__)
+
+#define WARNING(...){ \
+ if (verbosity_level>0) fprintf(stderr,"WARNING: " __VA_ARGS__); \
+ warn_count++; \
+ }
+
+#define WARN(...) WARNING(__VA_ARGS__)
+
+#define INFO(...){ \
+ if (verbosity_level>1) fprintf(stderr, " INFO: " __VA_ARGS__); \
+ msg_count++; \
+ }
+
+#define MESSAGE(...) INFO(__VA_ARGS__)
+
+#define MSG(...) MESSAGE(__VA_ARGS__)
+
+#define DEBUG(...){ \
+ if (verbosity_level>2) fprintf(stderr," DEBUG: " __VA_ARGS__);\
+ }
+#define DBG(...) DEBUG(__VA_ARGS__)
+
+
+#endif
+
+
+