Giuseppe Lavagetto has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/218611

Change subject: conftool: adjust logging, allow --debug for both tools
......................................................................

conftool: adjust logging, allow --debug for both tools

Change-Id: I016e5f477a6141a446359af87b61ce1c83781462
---
M conftool/cli/syncer.py
M conftool/cli/tool.py
2 files changed, 18 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/software/conftool 
refs/changes/11/218611/1

diff --git a/conftool/cli/syncer.py b/conftool/cli/syncer.py
index 486cc4c..043b9fa 100644
--- a/conftool/cli/syncer.py
+++ b/conftool/cli/syncer.py
@@ -143,8 +143,11 @@
     parser = argparse.ArgumentParser(description="Tool to sync the declared "
                                      "configuration on-disk with the kvstore "
                                      "data")
-    parser.add_argument('--directory', help="Directory containing the files to 
sync")
+    parser.add_argument('--directory',
+                        help="Directory containing the files to sync")
     parser.add_argument('--config', help="Configuration file")
+    parser.add_argument('--debug', action="store_true",
+                        default=False, help="print debug info")
     return parser.parse_args(args)
 
 
@@ -154,7 +157,6 @@
         arguments.pop(0)
 
     args = get_args(arguments)
-    logging.basicConfig(level=logging.DEBUG)
     try:
         c = configuration.get(args.config)
         KVObject.setup(c)
@@ -162,6 +164,12 @@
         raise
         _log.critical("Invalid configuration: %s", e)
         sys.exit(1)
+
+    if args.debug:
+        logging.basicConfig(level=logging.DEBUG)
+    else:
+        logging.basicConfig(level=logging.WARN)
+
     files = tag_files(args.directory)
     # Load services data.
     # TODO: This must be fixed to be less specific
diff --git a/conftool/cli/tool.py b/conftool/cli/tool.py
index a18127d..23e8717 100644
--- a/conftool/cli/tool.py
+++ b/conftool/cli/tool.py
@@ -33,8 +33,15 @@
                         help="the action to take: "
                         " [set/k1=v1:k2=v2...|get|delete] node", nargs=2,
                         required=True)
+    parser.add_argument('--debug', action="store_true",
+                        default=False, help="print debug info")
     args = parser.parse_args(cmdline)
-    logging.basicConfig(level=logging.WARN)
+
+    if args.debug:
+        logging.basicConfig(level=logging.DEBUG)
+    else:
+        logging.basicConfig(level=logging.WARN)
+
     try:
         c = configuration.get(args.config)
         KVObject.setup(c)

-- 
To view, visit https://gerrit.wikimedia.org/r/218611
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I016e5f477a6141a446359af87b61ce1c83781462
Gerrit-PatchSet: 1
Gerrit-Project: operations/software/conftool
Gerrit-Branch: master
Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to