chiark / gitweb /
Always use the same logging format
authorDaniel Martí <mvdan@mvdan.cc>
Mon, 5 Oct 2015 19:43:08 +0000 (21:43 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Mon, 5 Oct 2015 19:43:08 +0000 (21:43 +0200)
This helps differentiate errors, warnings and regular messages.

fdroid

diff --git a/fdroid b/fdroid
index 9199ee6594313e0e4150dae16184b756a9e9897a..ef3a001a011e90dbc650cf0b1a23e9ad6c5d6a14 100755 (executable)
--- a/fdroid
+++ b/fdroid
@@ -99,12 +99,15 @@ def main():
     verbose = any(s in sys.argv for s in ['-v', '--verbose'])
     quiet = any(s in sys.argv for s in ['-q', '--quiet'])
 
+    # Helpful to differentiate warnings from errors even when on quiet
+    logformat = '%(levelname)s: %(message)s'
+    loglevel = logging.INFO
     if verbose:
-        logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
+        loglevel = logging.DEBUG
     elif quiet:
-        logging.basicConfig(format='%(message)s', level=logging.WARN)
-    else:
-        logging.basicConfig(format='%(message)s', level=logging.INFO)
+        loglevel = logging.WARN
+
+    logging.basicConfig(format=logformat, level=loglevel)
 
     if verbose and quiet:
         logging.critical("Specifying --verbose and --quiet and the same time is silly")