Commit 1cec4046 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

[click_helper] Add an ignore variable to log_parameters

parent 769a2a94
Pipeline #21826 passed with stage
in 9 minutes and 35 seconds
......@@ -371,18 +371,22 @@ class AliasedGroup(click.Group):
ctx.fail('Too many matches: %s' % ', '.join(sorted(matches)))
def log_parameters(logger_handle):
def log_parameters(logger_handle, ignore=tuple()):
"""Logs the click parameters with the logging module.
Parameters
----------
logger_handle : object
The logger handle to write debug information into.
ignore : tuple
The keys in ignore will not be logged.
"""
ctx = click.get_current_context()
# do not sort the ctx.params dict. The insertion order is kept in Python 3
# and is useful (but not necessary so works on Python 2 too).
for k, v in ctx.params.items():
if k in ignore:
continue
logger_handle.debug('%s: %s', k, v)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment