From 1653c26aea4a97b5ec31e0ae80804b998d2f1318 Mon Sep 17 00:00:00 2001 From: Dan Duvall Date: Fri, 19 Jan 2024 11:01:39 -0800 Subject: [PATCH] Support `--debug` CLI option to enable debug logging Change-Id: Ic40399ff08e5e2384e1db2458099c0fb65b9fa55 --- gerritlab/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gerritlab/main.py b/gerritlab/main.py index d9a3943..e3e1683 100644 --- a/gerritlab/main.py +++ b/gerritlab/main.py @@ -1,3 +1,4 @@ +import logging import shutil import time import os @@ -313,6 +314,12 @@ def main(): nargs="?", help="The final branch that commits are intended to be merged into.", ) + parser.add_argument( + "--debug", + action="store_true", + default=False, + help="Show debugging information (subprocesses, HTTP requests, etc).", + ) parser.add_argument( "--merge", "-m", @@ -336,6 +343,9 @@ def main(): ) args = parser.parse_args() + if args.debug: + logging.basicConfig(level=logging.DEBUG) + repo = Repo(os.getcwd(), search_parent_directories=True) ensure_commitmsg_hook(repo.git_dir)