aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorokan2018-02-04 22:56:26 +0000
committerokan2018-02-04 22:56:26 +0000
commit69612bdea7ce4935bf16e616320045742af5ca20 (patch)
tree55d7999dde386acd6e4490b9686f126c104d1cb8 /util.c
parent49f8a10570f46a2a33c393e2bc578feff7a3bbca (diff)
downloadcwm-69612bdea7ce4935bf16e616320045742af5ca20.tar.gz
Slightly expand and expose verbose debugging.
Diffstat (limited to 'util.c')
-rw-r--r--util.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/util.c b/util.c
index 6898a26..5eb059f 100644
--- a/util.c
+++ b/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);
}