coloredlogs package is easy. Just install the coloredlogs package from PIP, import
coloredlogs, and initialize like the following:
isatty parameter. By default, coloredlogs detects whether or not you’re in a terminal and enabled ANSI output accordingly. This means that you won’t see ANSI output in Jenkins unless you explicitly pass
Make sure to check “Color ANSI Console Output” in your job config. Using “xterm” for “ANSI color map” worked fine for me.
As this will add another handler to the logging, you may see duplicate logging if you have any other handlers.
For more information on configuration, see the documentation.