diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2018-02-04 22:56:27 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2018-02-04 22:56:27 +0000 |
commit | aa4aa04514ede79f37b8d036b8a74d6b57d9ab44 (patch) | |
tree | 98b14896ea93a627f45035bb0563fafede238dd7 /app/cwm/util.c | |
parent | e0f6d4080b431c430171aef1c298d9b7456adc33 (diff) |
Slightly expand and expose verbose debugging.
Diffstat (limited to 'app/cwm/util.c')
-rw-r--r-- | app/cwm/util.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/app/cwm/util.c b/app/cwm/util.c index 6898a267a..5eb059fc0 100644 --- a/app/cwm/util.c +++ b/app/cwm/util.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: util.c,v 1.21 2018/02/02 13:40:55 okan Exp $ + * $OpenBSD: util.c,v 1.22 2018/02/04 22:56:26 okan Exp $ */ #include <sys/types.h> @@ -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); } |