use dimmed color style for full log text

This commit is contained in:
Robert Kaussow 2020-04-06 08:34:25 +02:00
parent f43f3dbc30
commit 22080185db
2 changed files with 11 additions and 11 deletions

View File

@ -26,7 +26,7 @@ def _should_do_markup():
return sys.stdout.isatty() and os.environ.get("TERM") != "dumb" 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): def flag_extra(extra):
@ -158,25 +158,25 @@ def _get_critical_handler(json=False):
def critical(message): def critical(message):
"""Format critical messages and return string.""" """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): def error(message):
"""Format error messages and return string.""" """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): def warn(message):
"""Format warn messages and return string.""" """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): def info(message):
"""Format info messages and return string.""" """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. Colorize strings.
@ -185,5 +185,5 @@ def color_text(color, light, msg):
:returns: string :returns: string
""" """
msg = msg.format(light) msg = msg.format(colorama.Style.DIM)
return "{}{}{}".format(color, msg, colorama.Style.RESET_ALL) return "{}{}{}".format(color, msg, colorama.Style.RESET_ALL)

View File

@ -23,7 +23,7 @@ def test_critical(capsys, mocker):
print( print(
"{}CRITICAL: {}foo\n{}".format( "{}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() x, _ = capsys.readouterr()
@ -38,7 +38,7 @@ def test_error(capsys, mocker):
print( print(
"{}ERROR: {}foo\n{}".format( "{}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() x, _ = capsys.readouterr()
@ -53,7 +53,7 @@ def test_warn(capsys, mocker):
print( print(
"{}WARNING: {}foo\n{}".format( "{}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() x, _ = capsys.readouterr()
@ -68,7 +68,7 @@ def test_info(capsys, mocker):
print( print(
"{}INFO: {}foo\n{}".format( "{}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() x, _ = capsys.readouterr()