improve output messages

Change the order of initialization so the logging module is configured
before the configuration file is read. This lets us log debug messages
from the config module.

Add some information from the config module about which configuration
file is loaded, and in verbose mode which files we're looking for.

Add some information to the scanner output to show whether
collapse_pre_releases is set to true.

Change-Id: Ia78bc63e2c29de2ac8771b46397a63639012bb90
Addresses-Bug: #1743202
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-01-14 10:15:32 -05:00
parent 7d419d4df6
commit 32b5405d0e
3 changed files with 13 additions and 5 deletions

@ -188,6 +188,7 @@ class Config(object):
os.path.join(self.reporoot, 'reno.yaml')]
for filename in filenames:
LOG.debug('looking for configuration file %s', filename)
if os.path.isfile(filename):
break
else:
@ -197,6 +198,7 @@ class Config(object):
try:
with open(filename, 'r') as fd:
self._contents = yaml.safe_load(fd)
LOG.info('loaded configuration file %s', filename)
except IOError as err:
LOG.warning('did not load config file %s: %s', filename, err)
else:

@ -191,12 +191,13 @@ def main(argv=sys.argv[1:]):
do_linter.set_defaults(func=linter.lint_cmd)
args = parser.parse_args(argv)
conf = config.Config(args.reporoot, args.relnotesdir)
conf.override_from_parsed_args(args)
logging.basicConfig(
level=args.verbosity,
format='%(message)s',
)
conf = config.Config(args.reporoot, args.relnotesdir)
conf.override_from_parsed_args(args)
return args.func(args, conf)

@ -912,9 +912,14 @@ class Scanner(object):
collapse_pre_releases = self.conf.collapse_pre_releases
stop_at_branch_base = self.conf.stop_at_branch_base
LOG.info('scanning %s/%s (branch=%s earliest_version=%s)',
reporoot.rstrip('/'), notesdir.lstrip('/'),
branch or '*current*', earliest_version)
LOG.info(
('scanning %s/%s '
'(branch=%s earliest_version=%s collapse_pre_releases=%s)'),
reporoot.rstrip('/'), notesdir.lstrip('/'),
branch or '*current*',
earliest_version,
collapse_pre_releases,
)
# Determine the current version, which might be an unreleased or
# dev version if there are unreleased commits at the head of the