Skip to content

Instantly share code, notes, and snippets.

@natedub
natedub / colorformatter.py
Created July 23, 2011 21:10
Colorizing and formatting Python logging console output for better readability
"""
This colorizing :class:`logging.Formatter` implementation adds ANSI color
sequences to make logging output more readable.
SQLAlchemy queryies are treated specially: Pygments formats the query
string and the bind params. Python tracebacks are also formatted by
Pygments. Package names vary their colors as well, see the MY_APP_NAME
setting.
If you're configuring logging via a INI file, add this formatter like so: