README.md 847 B

pycolog

Simple logging formatter adding color codes to messages depending on log level. It's easy but I was tired of rewriting it on each project.

Use it like this:

from pycolog import ColoredFormatter

# You can use it as a regular formatter, specifying fmt as you need.
log_formatter = ColoredFormatter("%(asctime)s: %(message)s" 

# You also may chose a custom color set. Any level not specified will be
# printed with regular color.
log_formatter2 = ColoredFormatter( "%(message)s",
                                   colors = {
                                       "WARNING" : ColoredFormatter.BLUE,
                                       "ERROR"   : ColoredFormatter.YELLOW,
                                       } )

The code is really easy. Take a look if you want more details (all available colors and such).