mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-25 22:30:42 +00:00
use dimmed color style for full log text
This commit is contained in:
parent
f43f3dbc30
commit
22080185db
@ -26,7 +26,7 @@ def _should_do_markup():
|
||||
return sys.stdout.isatty() and os.environ.get("TERM") != "dumb"
|
||||
|
||||
|
||||
colorama.init(autoreset=True, strip=not _should_do_markup())
|
||||
colorama.init(autoreset=True, strip=(not _should_do_markup()))
|
||||
|
||||
|
||||
def flag_extra(extra):
|
||||
@ -158,25 +158,25 @@ def _get_critical_handler(json=False):
|
||||
|
||||
def critical(message):
|
||||
"""Format critical messages and return string."""
|
||||
return color_text(colorama.Fore.RED, colorama.Fore.LIGHTRED_EX, message)
|
||||
return color_text(colorama.Fore.RED, message)
|
||||
|
||||
|
||||
def error(message):
|
||||
"""Format error messages and return string."""
|
||||
return color_text(colorama.Fore.RED, colorama.Fore.LIGHTRED_EX, message)
|
||||
return color_text(colorama.Fore.RED, message)
|
||||
|
||||
|
||||
def warn(message):
|
||||
"""Format warn messages and return string."""
|
||||
return color_text(colorama.Fore.YELLOW, colorama.Fore.LIGHTYELLOW_EX, message)
|
||||
return color_text(colorama.Fore.YELLOW, message)
|
||||
|
||||
|
||||
def info(message):
|
||||
"""Format info messages and return string."""
|
||||
return color_text(colorama.Fore.BLUE, colorama.Fore.LIGHTBLUE_EX, message)
|
||||
return color_text(colorama.Fore.BLUE, message)
|
||||
|
||||
|
||||
def color_text(color, light, msg):
|
||||
def color_text(color, msg):
|
||||
"""
|
||||
Colorize strings.
|
||||
|
||||
@ -185,5 +185,5 @@ def color_text(color, light, msg):
|
||||
:returns: string
|
||||
|
||||
"""
|
||||
msg = msg.format(light)
|
||||
msg = msg.format(colorama.Style.DIM)
|
||||
return "{}{}{}".format(color, msg, colorama.Style.RESET_ALL)
|
||||
|
@ -23,7 +23,7 @@ def test_critical(capsys, mocker):
|
||||
|
||||
print(
|
||||
"{}CRITICAL: {}foo\n{}".format(
|
||||
colorama.Fore.RED, colorama.Fore.LIGHTRED_EX, colorama.Style.RESET_ALL
|
||||
colorama.Fore.RED, colorama.Style.DIM, colorama.Style.RESET_ALL
|
||||
)
|
||||
)
|
||||
x, _ = capsys.readouterr()
|
||||
@ -38,7 +38,7 @@ def test_error(capsys, mocker):
|
||||
|
||||
print(
|
||||
"{}ERROR: {}foo\n{}".format(
|
||||
colorama.Fore.RED, colorama.Fore.LIGHTRED_EX, colorama.Style.RESET_ALL
|
||||
colorama.Fore.RED, colorama.Style.DIM, colorama.Style.RESET_ALL
|
||||
)
|
||||
)
|
||||
x, _ = capsys.readouterr()
|
||||
@ -53,7 +53,7 @@ def test_warn(capsys, mocker):
|
||||
|
||||
print(
|
||||
"{}WARNING: {}foo\n{}".format(
|
||||
colorama.Fore.YELLOW, colorama.Fore.LIGHTYELLOW_EX, colorama.Style.RESET_ALL
|
||||
colorama.Fore.YELLOW, colorama.Style.DIM, colorama.Style.RESET_ALL
|
||||
)
|
||||
)
|
||||
x, _ = capsys.readouterr()
|
||||
@ -68,7 +68,7 @@ def test_info(capsys, mocker):
|
||||
|
||||
print(
|
||||
"{}INFO: {}foo\n{}".format(
|
||||
colorama.Fore.BLUE, colorama.Fore.LIGHTBLUE_EX, colorama.Style.RESET_ALL
|
||||
colorama.Fore.BLUE, colorama.Style.DIM, colorama.Style.RESET_ALL
|
||||
)
|
||||
)
|
||||
x, _ = capsys.readouterr()
|
||||
|
Loading…
Reference in New Issue
Block a user