limitations under the License.
*/
+#include <stdio.h>
+#include <stdarg.h>
#include "verbose.h"
-#if !defined(NDEBUG)
int verbosity = 1;
-#else
-void verbose_error(const char *file, int line)
+
+static const char *prefixes[] = {
+ "<0> EMERGENCY",
+ "<1> ALERT",
+ "<2> CRITICAL",
+ "<3> ERROR",
+ "<4> WARNING",
+ "<5> NOTICE",
+ "<6> INFO",
+ "<7> DEBUG"
+};
+
+void verbose(int level, const char *file, int line, const char *fmt, ...)
{
- syslog(LOG_ERR, "error file %s line %d", file, line);
-}
-#endif
+ va_list ap;
+ fprintf(stderr, "%s: ", prefixes[level < 0 ? 0 : level > 7 ? 7 : level]);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, " [%s:%d]\n", file, line);
+}