Slightly expand and expose verbose debugging.

This commit is contained in:
okan
2018-02-04 22:56:26 +00:00
parent 8623c7add7
commit 14c17b5f9b
5 changed files with 38 additions and 28 deletions

8
util.c
View File

@@ -123,14 +123,16 @@ log_msg(const char *msg, va_list ap)
}
void
log_debug(const char *func, const char *msg, ...)
log_debug(int level, const char *func, const char *msg, ...)
{
char *fmt;
va_list ap;
if (Conf.debug < level)
return;
va_start(ap, msg);
if (asprintf(&fmt, "%s: %s", func, msg) == -1)
exit(1);
xasprintf(&fmt, "debug%d: %s: %s", level, func, msg);
log_msg(fmt, ap);
va_end(ap);
}