Skip to content

Commit cb9dba0

Browse files
committed
tools/get_release_contributors: Improve logging
1 parent 3b8cef6 commit cb9dba0

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

tools/get_release_contributors.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ def find_contributors(git_log_selector, from_, to):
218218
contributors.add(contributor)
219219
co_authors = re.findall('Co-authored-by:\s*(\S.*(<[^ >]+>))\s*(?:$|\n)', commit, re.I)
220220
for co_author_full, co_author_email in co_authors:
221+
logger.debug(f'checking co author {co_author_full}')
221222
contributor = authors.get_login_or_realname(co_author_full, None)
222223
if not contributor or not contributor.startswith('@'):
223224
# try to find a previous commit by this mail address
@@ -241,7 +242,6 @@ def find_contributors(git_log_selector, from_, to):
241242

242243

243244
if __name__ == '__main__':
244-
logging.basicConfig(format='%(levelname)s %(message)s')
245245
p = argparse.ArgumentParser(
246246
description='Generates a list of Github user names who contributed to a specific release.')
247247
p.add_argument('--from', dest='from_', required=True,
@@ -252,7 +252,20 @@ def find_contributors(git_log_selector, from_, to):
252252
help='the path to the git repository to be analyzed, e.g. ./jamuluswebsite')
253253
p.add_argument('--github-token',
254254
help='a Github Personal Access Token; optional, but might be needed if we exceed the anonymous API requests per hour limit')
255+
p.add_argument('--verbose', '-v', action='store_true',
256+
help='enable verbose output')
257+
p.add_argument('--quiet', '-q', action='store_true',
258+
help='only log errors')
255259
args = p.parse_args()
260+
if args.verbose and args.quiet:
261+
p.error('--verbose and --quiet are mutually exclusive')
262+
if args.verbose:
263+
level = logging.DEBUG
264+
elif args.quiet:
265+
level = logging.ERROR
266+
else:
267+
level = logging.WARNING
268+
logging.basicConfig(format='%(levelname)s %(message)s', level=level)
256269
os.chdir(args.repo)
257270
authors.set_github_token(args.github_token)
258271
main(args.from_, args.to)

0 commit comments

Comments
 (0)