From e19e1a93f614bc40a4ec2dd6fc026ed384cf5fd6 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 20 Nov 2012 10:10:37 +0200 Subject: [PATCH] msger: sync with the new rewritten gbp logging Signed-off-by: Markus Lehtonen --- gitbuildsys/cmd_export.py | 1 + gitbuildsys/cmd_import.py | 1 + gitbuildsys/msger.py | 18 +++++++++++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/gitbuildsys/cmd_export.py b/gitbuildsys/cmd_export.py index 349b570..18ed8f4 100644 --- a/gitbuildsys/cmd_export.py +++ b/gitbuildsys/cmd_export.py @@ -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, diff --git a/gitbuildsys/cmd_import.py b/gitbuildsys/cmd_import.py index 4ce7367..181faf1 100644 --- a/gitbuildsys/cmd_import.py +++ b/gitbuildsys/cmd_import.py @@ -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"): diff --git a/gitbuildsys/msger.py b/gitbuildsys/msger.py index a5f68d3..1011863 100644 --- a/gitbuildsys/msger.py +++ b/gitbuildsys/msger.py @@ -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 -- 2.7.4