From: Supriya Kannery Date: Thu, 30 Jun 2011 08:22:32 +0000 (+0530) Subject: virsh: Make "DEBUG" loglevel the superset X-Git-Tag: v0.9.4-rc1~185 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1710ca6a05b8e679dde6ff26b560a68bf196485;p=thirdparty%2Flibvirt.git virsh: Make "DEBUG" loglevel the superset Aligning loglevel values of virsh to that of libvirt. "DEBUG"=0 loglevel, when specified through commandline or env variable, should log all the messages. "ERROR=4" should log only error messages. Signed-off-by: Supriya Kannery --- diff --git a/tools/virsh.c b/tools/virsh.c index 84ef2d5e68..563497e530 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -13331,13 +13331,17 @@ vshDebug(vshControl *ctl, int level, const char *format, ...) va_list ap; char *str; + /* Aligning log levels to that of libvirt. + * Traces with levels >= user-specified-level + * gets logged into file + */ + if (level < ctl->debug) + return; + va_start(ap, format); - vshOutputLogFile(ctl, VSH_ERR_DEBUG, format, ap); + vshOutputLogFile(ctl, level, format, ap); va_end(ap); - if (level > ctl->debug) - return; - va_start(ap, format); if (virVasprintf(&str, format, ap) < 0) { /* Skip debug messages on low memory */