include/common.h
branchpyrit
changeset 30 33f95441790e
parent 22 76b7bd51d64a
child 34 28f6e8b9d5d1
--- a/include/common.h	Sat Dec 08 14:07:42 2007 +0100
+++ b/include/common.h	Sat Dec 08 16:02:37 2007 +0100
@@ -15,14 +15,26 @@
 # define Inf FLT_MAX
 #endif
 
-inline void infomsg(const char *format, ...)
+/* verbosity level:
+0: only errors (E)
+1: major status messages (*)
+2: minor status, progress (-)
+3: debug messages (D)
+4: more debug
+default = 2
+*/
+extern int pyrit_verbosity;
+
+inline void dbgmsg(const int vlevel, const char *format, ...)
 {
-#ifndef PYRIT_QUIET
-	va_list ap;
-	va_start(ap, format);
-	vprintf(format, ap);
-	va_end(ap);
-#endif
+	if (pyrit_verbosity >= vlevel)
+	{
+		va_list ap;
+		va_start(ap, format);
+		vprintf(format, ap);
+		va_end(ap);
+		fflush(stdout);
+	}
 }
 
 #endif