Fix FORMAT definition for logging module.
authormeisterluk <admin@lukas-prokop.at>
Sat, 4 May 2013 19:57:57 +0000 (21:57 +0200)
committerMichael Prokop <mika@grml.org>
Mon, 13 May 2013 09:04:14 +0000 (11:04 +0200)
Level does not specify that only messages of this level are printed
out, but the minimum level. So a definition like this

    FORMAT = "Debug: %(asctime)-15s %(message)s"
    FORMAT = "%(asctime)-15s %(message)s"

misleads the user into thinking that every message printed out is
actually a debug message, which is not true.
We now use "%(message)s" for everything except verbose mode which
annotates the timestamp to the message.

grml2usb

index d5a8675..6cb76c0 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -1645,14 +1645,13 @@ def handle_logging():
     if options.verbose and options.quiet:
         parser.error("please use either verbose (--verbose) or quiet (--quiet) option")
 
+    FORMAT = "%(message)s"
     if options.verbose:
-        FORMAT = "Debug: %(asctime)-15s %(message)s"
+        FORMAT = "%(asctime)-15s %(message)s"
         logging.basicConfig(level=logging.DEBUG, format=FORMAT)
     elif options.quiet:
-        FORMAT = "Critical: %(message)s"
         logging.basicConfig(level=logging.CRITICAL, format=FORMAT)
     else:
-        FORMAT = "%(message)s"
         logging.basicConfig(level=logging.INFO, format=FORMAT)