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>
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 */