diff options
author | okan | 2018-02-04 22:56:26 +0000 |
---|---|---|
committer | okan | 2018-02-04 22:56:26 +0000 |
commit | 69612bdea7ce4935bf16e616320045742af5ca20 (patch) | |
tree | 55d7999dde386acd6e4490b9686f126c104d1cb8 /util.c | |
parent | 49f8a10570f46a2a33c393e2bc578feff7a3bbca (diff) | |
download | cwm-69612bdea7ce4935bf16e616320045742af5ca20.tar.gz |
Slightly expand and expose verbose debugging.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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); } |