logging: Change logging levels in cros_merge_to_branch
Promote all info level logs messages to notice level. Change the default
logging level if --debug flag is not passed to be notice instead of
error.
BUG=chromium:473762
TEST=none
Change-Id: I8b3790ce1272319726cf12eb17410ca129d6dcfd
Reviewed-on: https://chromium-review.googlesource.com/264064
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ralph Nathan <ralphnathan@chromium.org>
Trybot-Ready: Ralph Nathan <ralphnathan@chromium.org>
Tested-by: Ralph Nathan <ralphnathan@chromium.org>
diff --git a/scripts/cros_merge_to_branch.py b/scripts/cros_merge_to_branch.py
index a2fc8e8..740a3a3 100644
--- a/scripts/cros_merge_to_branch.py
+++ b/scripts/cros_merge_to_branch.py
@@ -146,8 +146,8 @@
def _SetupWorkDirectoryForPatch(work_dir, patch, branch, manifest, email):
"""Set up local dir for uploading changes to the given patch's project."""
- logging.info('Setting up dir %s for uploading changes to %s', work_dir,
- patch.project_url)
+ logging.notice('Setting up dir %s for uploading changes to %s', work_dir,
+ patch.project_url)
# Clone the git repo from reference if we have a pointer to a
# ManifestCheckout object.
@@ -176,7 +176,7 @@
mbranch = git.MatchSingleBranchName(
work_dir, branch, namespace='refs/remotes/origin/')
if branch != mbranch:
- logging.info('Auto resolved branch name "%s" to "%s"', branch, mbranch)
+ logging.notice('Auto resolved branch name "%s" to "%s"', branch, mbranch)
branch = mbranch
# Finally, create a local branch for uploading changes to the given remote
@@ -222,7 +222,7 @@
# Suppress all logging info output unless we're running debug.
if not options.debug:
- logging.getLogger().setLevel(logging.ERROR)
+ logging.getLogger().setLevel(logging.NOTICE)
# Get a pointer to your repo checkout to look up the local project paths for
# both email addresses and for using your checkout as a git mirror.
@@ -242,7 +242,7 @@
else:
if not options.email:
chromium_email = '%s@chromium.org' % os.environ['USER']
- logging.info('--nomirror set without email, using %s', chromium_email)
+ logging.notice('--nomirror set without email, using %s', chromium_email)
options.email = chromium_email
index = 0
@@ -258,15 +258,15 @@
# Now that we have the project checked out, let's apply our change and
# create a new change on Gerrit.
- logging.info('Uploading change %s to branch %s', change, branch)
+ logging.notice('Uploading change %s to branch %s', change, branch)
urls = _UploadChangeToBranch(work_dir, patch, branch, options.draft,
options.dryrun)
- logging.info('Successfully uploaded %s to %s', change, branch)
+ logging.notice('Successfully uploaded %s to %s', change, branch)
for url in urls:
if url.endswith('\x1b[K'):
# Git will often times emit these escape sequences.
url = url[0:-3]
- logging.info(' URL: %s', url)
+ logging.notice(' URL: %s', url)
except (cros_build_lib.RunCommandError, cros_patch.ApplyPatchException,
git.AmbiguousBranchName, OSError) as e:
@@ -277,18 +277,19 @@
logging.warning('############## SOME CHANGES FAILED TO UPLOAD ############')
if good_changes:
- logging.info('Successfully uploaded change(s) %s', ' '.join(good_changes))
+ logging.notice(
+ 'Successfully uploaded change(s) %s', ' '.join(good_changes))
# Printing out the error here so that we can see exactly what failed. This
# is especially useful to debug without using --debug.
logging.error('Upload failed with %s', str(e).strip())
if not options.wipe:
- logging.info('Not wiping the directory. You can inspect the failed '
- 'change at %s; After fixing the change (if trivial) you can '
- 'try to upload the change by running:\n'
- 'git commit -a -c CHERRY_PICK_HEAD\n'
- 'git push %s HEAD:refs/for/%s', work_dir, patch.project_url,
- branch)
+ logging.error('Not wiping the directory. You can inspect the failed '
+ 'change at %s; After fixing the change (if trivial) you can'
+ ' try to upload the change by running:\n'
+ 'git commit -a -c CHERRY_PICK_HEAD\n'
+ 'git push %s HEAD:refs/for/%s', work_dir, patch.project_url,
+ branch)
else:
logging.error('--nowipe not set thus deleting the work directory. If you '
'wish to debug this, re-run the script with change(s) '
@@ -307,9 +308,9 @@
shutil.rmtree(root_work_dir)
if options.dryrun:
- logging.info('Success! To actually upload changes, re-run without '
- '--dry-run.')
+ logging.notice('Success! To actually upload changes, re-run without '
+ '--dry-run.')
else:
- logging.info('Successfully uploaded all changes requested.')
+ logging.notice('Successfully uploaded all changes requested.')
return 0