[Branch,~linaro-validation/lava-test/trunk] Rev 127: Merge support for --vebose

Message ID 20120308170311.20957.15377.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Zygmunt Krynicki March 8, 2012, 5:03 p.m.
Merge authors:
  Le Chi Thu le.chi.thu@linaro.org <le.chi.thu@linaro.org>
  Zygmunt Krynicki (zkrynicki)
------------------------------------------------------------
revno: 127 [merge]
committer: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
branch nick: trunk
timestamp: Thu 2012-03-08 17:59:45 +0100
message:
  Merge support for --vebose
modified:
  doc/changes.rst
  lava_test/commands.py
  lava_test/core/config.py
  lava_test/main.py


--
lp:lava-test
https://code.launchpad.net/~linaro-validation/lava-test/trunk

You are subscribed to branch lp:lava-test.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-test/trunk/+edit-subscription

Patch

=== modified file 'doc/changes.rst'
--- doc/changes.rst	2012-03-08 10:21:25 +0000
+++ doc/changes.rst	2012-03-08 16:59:15 +0000
@@ -12,6 +12,7 @@ 
  * Improved error output when running inside virtualenv where the apt and
    lsb_release modules are not visible to python.
  * Enabled URL cache used by the ``lava-test register`` command.
+ * Add command line switch ``--verbose`` that turns on lots of messages
 
 .. _version_0_4:
 

=== modified file 'lava_test/commands.py'
--- lava_test/commands.py	2012-03-06 17:54:26 +0000
+++ lava_test/commands.py	2012-03-05 21:43:48 +0000
@@ -36,9 +36,17 @@ 
         self._config = get_config()
         self._test_loader = TestLoader(self._config)
 
+        if self.args.verbose:
+            logging.root.setLevel(logging.DEBUG)
+
     @classmethod
     def register_arguments(cls, parser):
         parser.add_argument(
+           "-v", "--verbose",
+           action="store_true",
+           default=False,
+           help="Be verbose about undertaken actions")
+        parser.add_argument(
             "-q", "--quiet",
             action="store_true",
             default=False,

=== modified file 'lava_test/core/config.py'
--- lava_test/core/config.py	2011-09-13 20:25:06 +0000
+++ lava_test/core/config.py	2012-03-05 21:43:48 +0000
@@ -75,13 +75,6 @@ 
             provider_info["config"] = {}
         return provider_info["config"]
 
-    def get_logging_config_file(self):
-        logging_file = os.path.join(self.configdir, "logging.conf")
-        if os.path.exists(logging_file):
-            return logging_file
-        else:
-            return None
-
 _config = None
 
 

=== modified file 'lava_test/main.py'
--- lava_test/main.py	2012-02-07 22:26:47 +0000
+++ lava_test/main.py	2012-03-05 21:43:48 +0000
@@ -34,17 +34,11 @@ 
 
 
 def main():
-
-    logging_config_file = get_config().get_logging_config_file()
-
-    if logging_config_file != None:
-        logging.config.fileConfig(logging_config_file)
-    else:
-        # config the python logging
-       FORMAT = '<LAVA_TEST>%(asctime)s %(levelname)s: %(message)s'
-       DATEFMT= '%Y-%m-%d %I:%M:%S %p'
-       logging.basicConfig(format=FORMAT,datefmt=DATEFMT)
-       logging.root.setLevel(logging.ERROR)
+    # default logging level is warning. -v or --verbose will change it to debug (in Command class).
+    FORMAT = '<LAVA_TEST>%(asctime)s %(levelname)s: %(message)s'
+    DATEFMT= '%Y-%m-%d %I:%M:%S %p'
+    logging.basicConfig(format=FORMAT,datefmt=DATEFMT)
+    logging.root.setLevel(logging.WARNING)
 
     run_with_dispatcher_class(LAVATestDispatcher)