[Yum-devel] [PATCH] Add debuglevel -1. BZ 873428, BZ 982088

Zdenek Pavlas zpavlas at redhat.com
Tue Jul 9 11:18:31 UTC 2013


We need a way to turn off INFO messages, but keep WARN, ERROR, and
CRITICAL. A new loglevel -1 inserted between former levels -1 and 0
facilitates that, with minimal impact on old code (-1 was never
documented, and disabling EVERYTHING is not a good idea anyway).

The main user for this is yum-cron.
---
 docs/yum.conf.5      | 2 +-
 yum-cron/yum-cron.py | 4 ++--
 yum/config.py        | 2 +-
 yum/logginglevels.py | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index 5b626b9..8c328f0 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -50,7 +50,7 @@ repositories that yum will use.
 
 .IP
 \fBdebuglevel\fR
-Debug message output level. Practical range is 0\-10. Default is `2'.
+Debug message output level. Practical range is -1\-10. Default is `2'.
 
 .IP
 \fBerrorlevel\fR
diff --git a/yum-cron/yum-cron.py b/yum-cron/yum-cron.py
index 26526b7..a180498 100755
--- a/yum-cron/yum-cron.py
+++ b/yum-cron/yum-cron.py
@@ -797,8 +797,8 @@ class YumCronBase(yum.YumBase):
             if os.geteuid() != 0:
                 self.setCacheDir()
 
-            # Turn off the plugins line
-            self.preconf.debuglevel = 0
+            # Turn off everything but WARN+
+            self.preconf.debuglevel = -1
 
             # Create the configuration
             self.conf
diff --git a/yum/config.py b/yum/config.py
index 6fcfb3e..1ac2f21 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -710,7 +710,7 @@ class StartupConf(BaseConfig):
     the other [main] options can be parsed.
     """
     # xemacs highlighting hack: '
-    debuglevel = IntOption(2, 0, 10)
+    debuglevel = IntOption(2, -1, 10)
     errorlevel = IntOption(2, 0, 10)
 
     distroverpkg = Option('redhat-release')
diff --git a/yum/logginglevels.py b/yum/logginglevels.py
index dfdd90c..9980c39 100644
--- a/yum/logginglevels.py
+++ b/yum/logginglevels.py
@@ -87,7 +87,7 @@ def logLevelFromErrorLevel(error_level):
 
 def logLevelFromDebugLevel(debug_level):
     """ Convert an old-style debug logging level to the new style. """
-    debug_table = {-1 : __NO_LOGGING, 0 : logging.INFO, 1 : INFO_1, 2 : INFO_2,
+    debug_table = {-2 : __NO_LOGGING, -1: logging.WARNING, 0 : logging.INFO, 1 : INFO_1, 2 : INFO_2,
         3 : logging.DEBUG, 4 : DEBUG_1, 5 : DEBUG_2, 6 : DEBUG_3, 7 : DEBUG_4}
 
     return __convertLevel(debug_level, debug_table)
-- 
1.7.11.7



More information about the Yum-devel mailing list