Adjusted print_colored() kwargs

This commit is contained in:
2Shirt 2019-10-21 18:57:31 -07:00
parent 193511d83b
commit 3ecf107c39
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -824,10 +824,13 @@ def pause(prompt='Press Enter to continue... '):
input_text(prompt) input_text(prompt)
def print_colored(strings, colors, **kwargs): def print_colored(strings, colors, log=False, sep=' ', **kwargs):
"""Prints strings in the colors specified.""" """Prints strings in the colors specified."""
LOG.debug('strings: %s, colors: %s, kwargs: %s', strings, colors, kwargs) LOG.debug(
msg = color_string(strings, colors, sep=kwargs.get('sep', ' ')) 'strings: %s, colors: %s, sep: %s, kwargs: %s',
strings, colors, sep, kwargs,
)
msg = color_string(strings, colors, sep=sep)
print_options = { print_options = {
'end': kwargs.get('end', '\n'), 'end': kwargs.get('end', '\n'),
'file': kwargs.get('file', sys.stdout), 'file': kwargs.get('file', sys.stdout),
@ -835,7 +838,7 @@ def print_colored(strings, colors, **kwargs):
} }
print(msg, **print_options) print(msg, **print_options)
if kwargs.get('log', False): if log:
LOG.info(strip_colors(msg)) LOG.info(strip_colors(msg))