]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
virsh: Make "DEBUG" loglevel the superset
authorSupriya Kannery <supriyak@linux.vnet.ibm.com>
Thu, 30 Jun 2011 08:22:32 +0000 (13:52 +0530)
committerEric Blake <eblake@redhat.com>
Thu, 14 Jul 2011 13:06:16 +0000 (07:06 -0600)
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 <supriyak@in.ibm.com>
tools/virsh.c

index 84ef2d5e68adda3f98e638a1de96b8de55c9bbe6..563497e53011cca35a97f5c61218666c45661c0a 100644 (file)
@@ -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 */