Commit 7bc6ef78 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Merge branch 'p1' into 'master'

[click_helper] Add an ignore variable to log_parameters

See merge request !88
parents 769a2a94 1cec4046
Pipeline #21827 passed with stages
in 9 minutes and 46 seconds
......@@ -371,18 +371,22 @@ class AliasedGroup(click.Group):'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.
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:
logger_handle.debug('%s: %s', k, v)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment