Add Colors To Your Python Logs With Colorlog

colorlog is a drop-in replacement for the Python logging module that allows you to add color to your logs.

Start by installing the colorlog module with pip (or easy_install):

pip install colorlog

Then you can use colorlog the way you would use logging:

import colorlog
import logging

colorlog.basicConfig(level=logging.DEBUG)
colorlog.debug("debug")
colorlog.info("info")
colorlog.warning("warning")
colorlog.error("error")
colorlog.critical("critical")

And your log become much easier to read:

Color logging