Last Updated: February 25, 2016
·
474
· exhuma

Colourised Terminal Output for Python Logging

Here's a very simple way (and the correct) way to colourise logging output for the console:

https://gist.github.com/exhuma/8147910

The script uses blessings to deal with terminal intricacies. It's a very thin module. No external dependencies (at least at version 1.5.1) and makes colourising easy.

Next, it uses a standard "Formatter" to implement the core functionality. Don't use filters, don't put that code elsewhere! We are formatting the output. So a Formatter it is!