aboutsummaryrefslogtreecommitdiffstats
path: root/webmap-download
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2024-06-03 17:07:14 +0200
committerGuilhem Moulin <guilhem@fripost.org>2024-06-03 17:57:56 +0200
commitc5e2fced06705bd5d495deca79917ae055af6915 (patch)
tree134b092a0e91001045edfff7e0cadce1a7fb90f7 /webmap-download
parentdc4038860fd850dd08936dff64b124e41a2932a4 (diff)
webmap-download: Make --debug repeatable and skip HTTP debugging if it's passed only once.
This makes --debug less verbose by default and is useful for modules that do lots of HTTP connections such as WMS probing.
Diffstat (limited to 'webmap-download')
-rwxr-xr-xwebmap-download8
1 files changed, 5 insertions, 3 deletions
diff --git a/webmap-download b/webmap-download
index 7720e79..583c5dd 100755
--- a/webmap-download
+++ b/webmap-download
@@ -142,16 +142,18 @@ if __name__ == '__main__':
help='optional directory for lock files')
parser.add_argument('--quiet', action='store_true',
help='skip progress bars even when stderr is a TTY')
- parser.add_argument('--debug', action='store_true', help=argparse.SUPPRESS)
+ parser.add_argument('--debug', action='count', default=0,
+ help=argparse.SUPPRESS)
parser.add_argument('--exit-code', default=True, action=argparse.BooleanOptionalAction,
help='whether to exit with status 1 in case of download failures')
parser.add_argument('groupname', nargs='*', help='Group(s) to process')
args = parser.parse_args()
- if args.debug:
+ if args.debug > 0:
+ logging.getLogger().setLevel(logging.DEBUG)
+ if args.debug > 1:
from http.client import HTTPConnection
HTTPConnection.debuglevel = 1
- logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True