[Patch 2/3]virsh: Make "DEBUG" loglevel the superset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

---
 tools/virsh.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Index: libvirt/tools/virsh.c
===================================================================
--- libvirt.orig/tools/virsh.c
+++ libvirt/tools/virsh.c
@@ -13285,13 +13285,17 @@ vshDebug(vshControl *ctl, int level, con
     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 */

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]