From 6dcb4fdfa4a19c33769e1f2ccb04c5e615b05b4d Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Thu, 2 Jun 2016 04:43:31 -0400 Subject: [PATCH] Migrator script output tweaks, debug logging --- cli-v1-to-v2 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cli-v1-to-v2 b/cli-v1-to-v2 index b3fb7ca..91f01d5 100755 --- a/cli-v1-to-v2 +++ b/cli-v1-to-v2 @@ -25,6 +25,9 @@ def main(sysargs=sys.argv[:]): action='store_true', default=False) parser.add_argument('-q', '--quiet', help='quiet down the logging', action='store_true', default=False) + parser.add_argument('-D', '--debug', help='debug up the logging', + action='store_true', + default=(os.environ.get('DEBUG') != '')) parser.add_argument('--selftest', help='run internal tests', action='store_true', default=False) @@ -38,10 +41,10 @@ def main(sysargs=sys.argv[:]): test_migrators() return 0 - logging.basicConfig( - level=(logging.FATAL if args.quiet else logging.INFO), - format='%(message)s' - ) + level = logging.FATAL if args.quiet else logging.INFO + level = logging.DEBUG if args.debug else level + + logging.basicConfig(level=level, format='%(message)s') paths = args.path if len(paths) == 0: @@ -90,7 +93,7 @@ def _update_filepath(filepath): def _update_source(source): for migrator, func in _MIGRATORS: - logging.info('Running %s migrator', migrator) + logging.debug('Running %s migrator', migrator) source = func(source) return source