clr
: Color Text Easily¶
Color text.
Typical usage:
>>> red('red text', False)
Returns the string “red text” where the text will be red and the background will be the default.
>>> red('red background')
Returns the string “red background” where the text will be the default color and the background will be red.
-
common.clr.
add_color_log_levels
(center=False)[source]¶ Alter log level names to be colored.
Levels are colored to have black text and a background colored as follows:
- Level 50 (Critical): red
- Level 40 (Error): magenta
- Level 30 (Warning): yellow
- Level 20 (Info): blue
- Level 10 (Debug): green
- Level 0 (Not Set): white
Parameters: center (bool) – If log text should be centered. When set to True
, the text will be centered to the width of"CRITICAL"
, which is 8 characters. This makes it so the level in the log output always takes up the same number of characters.Return type: None