From ea34193f2996722db3c55c3f2911ec2dec466e19 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 10 Feb 2010 17:54:22 +0100
Subject: [PATCH] Change the debug CLI option to integer/count

This changes from boolean to integer/count (for a future differentiation
based on the actual debug level). All the uses of the code only test
it's boolean status, so it still works as an integer value.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/cli.py   | 5 ++---
 lib/utils.py | 6 +++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/cli.py b/lib/cli.py
index 523cab7b6..02837757e 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -483,9 +483,8 @@ cli_option = CliOption
 _YESNO = ("yes", "no")
 _YORNO = "yes|no"
 
-DEBUG_OPT = cli_option("-d", "--debug", default=False,
-                       action="store_true",
-                       help="Turn debugging on")
+DEBUG_OPT = cli_option("-d", "--debug", default=0, action="count",
+                       help="Increase debugging level")
 
 NOHDR_OPT = cli_option("--no-headers", default=False,
                        action="store_true", dest="no_headers",
diff --git a/lib/utils.py b/lib/utils.py
index 45f0ecdb5..77ab93895 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -1762,14 +1762,14 @@ def GetDaemonPort(daemon_name):
   return port
 
 
-def SetupLogging(logfile, debug=False, stderr_logging=False, program="",
+def SetupLogging(logfile, debug=0, stderr_logging=False, program="",
                  multithreaded=False, syslog=constants.SYSLOG_USAGE):
   """Configures the logging module.
 
   @type logfile: str
   @param logfile: the filename to which we should log
-  @type debug: boolean
-  @param debug: whether to enable debug messages too or
+  @type debug: integer
+  @param debug: if greater than zero, enable debug messages, otherwise
       only those at C{INFO} and above level
   @type stderr_logging: boolean
   @param stderr_logging: whether we should also log to the standard error
-- 
GitLab