msger: sync with the new rewritten gbp logging
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 20 Nov 2012 08:10:37 +0000 (10:10 +0200)
committerZhang Qiang <qiang.z.zhang@intel.com>
Thu, 22 Nov 2012 07:19:44 +0000 (15:19 +0800)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gitbuildsys/cmd_export.py
gitbuildsys/cmd_import.py
gitbuildsys/msger.py

index 349b570..18ed8f4 100644 (file)
@@ -92,6 +92,7 @@ def create_gbp_export_args(repo, commit, export_dir, tmp_dir, spec, args,
 
     # Now, start constructing the argument list
     argv = ["argv[0] placeholder",
+            "--git-color-scheme=magenta:green:yellow:red",
             "--git-ignore-new",
             "--git-upstream-branch=upstream",
             "--git-export-dir=%s" % export_dir,
index 4ce7367..181faf1 100644 (file)
@@ -37,6 +37,7 @@ def main(args):
     path = args.path
 
     params = ["argv[0] placeholder",
+              "--color-scheme=magenta:green:yellow:red",
               "--packaging-dir=%s" % get_packaging_dir(args),
               "--upstream-branch=%s" % args.upstream_branch, path]
     if not args.no_pristine_tar and os.path.exists("/usr/bin/pristine-tar"):
index a5f68d3..1011863 100644 (file)
@@ -75,15 +75,19 @@ STDERR = sys.stderr
 
 # Configure gbp logging
 import gbp.log
-gbp.log.logger.format = '%(color)s%(levelname)s: %(coloroff)s%(message)s'
+for level in (gbp.log.DEBUG, gbp.log.INFO, gbp.log.WARNING, gbp.log.ERROR):
+    gbp.log.logging.addLevelName(level,
+                                 gbp.log.logging.getLevelName(level).lower())
+gbp.log.LOGGER.set_format('%(color)s%(levelname)s: '
+                          '%(coloroff)s%(message)s')
 
 # Mapping for gbs->gbp log levels
 GBP_LOG_LEVELS = {
-                    'quiet': gbp.log.Logger.ERROR,
-                    'normal': gbp.log.Logger.INFO,
-                    'verbose': gbp.log.Logger.DEBUG,
-                    'debug': gbp.log.Logger.DEBUG,
-                    'never': gbp.log.Logger.ERROR
+                    'quiet': gbp.log.ERROR,
+                    'normal': gbp.log.INFO,
+                    'verbose': gbp.log.DEBUG,
+                    'debug': gbp.log.DEBUG,
+                    'never': gbp.log.ERROR
                  }
 
 class PrintBuf(object):
@@ -282,7 +286,7 @@ def set_loglevel(level):
     LOG_LEVEL = LOG_LEVELS[level]
 
     # set git-buildpackage log level
-    gbp.log.logger.set_level(GBP_LOG_LEVELS[level])
+    gbp.log.LOGGER.setLevel(GBP_LOG_LEVELS[level])
 
 def set_interactive(mode=True):
     global INTERACTIVE