From 1178501aaf969ece80a98887cf399541af13de21 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sun, 21 Apr 2019 12:41:09 +0100 Subject: [PATCH] appveyor: added logging level configuration --- scripts/appveyor.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/scripts/appveyor.py b/scripts/appveyor.py index e84e9af4..72a20631 100755 --- a/scripts/appveyor.py +++ b/scripts/appveyor.py @@ -26,13 +26,14 @@ STEP_PREFIX = 'step_' logger = logging.getLogger() logging.basicConfig( - level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s' + level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s' ) def main(): global opt opt = parse_cmdline() + logger.setLevel(opt.loglevel) setup_env() cmd = globals()[STEP_PREFIX + opt.step] @@ -487,14 +488,14 @@ def ensure_dir(dir): def run_command(cmdline, **kwargs): if not isinstance(cmdline, str): cmdline = list(map(str, cmdline)) - logger.debug("calling command: %s", cmdline) + logger.info("running command: %s", cmdline) sp.check_call(cmdline, **kwargs) def out_command(cmdline, **kwargs): if not isinstance(cmdline, str): cmdline = list(map(str, cmdline)) - logger.debug("calling command: %s", cmdline) + logger.info("running command: %s", cmdline) data = sp.check_output(cmdline, **kwargs) return data @@ -545,6 +546,26 @@ def parse_cmdline(): help="the target python architecture. Default from PYTHON_ARCH env var", ) + g = parser.add_mutually_exclusive_group() + g.add_argument( + '-q', + '--quiet', + help="Talk less", + dest='loglevel', + action='store_const', + const=logging.WARN, + default=logging.INFO, + ) + g.add_argument( + '-v', + '--verbose', + help="Talk more", + dest='loglevel', + action='store_const', + const=logging.DEBUG, + default=logging.INFO, + ) + steps = [ n[len(STEP_PREFIX) :] for n in globals()