Python 3 compatibility.

This commit is contained in:
Anthony Sottile
2014-04-12 18:19:57 -07:00
parent ddebb83a40
commit bb365a6e68
10 changed files with 30 additions and 27 deletions

View File

@@ -14,12 +14,13 @@ LOG_LEVEL_COLORS = {
class LoggingHandler(logging.Handler):
def __init__(self, use_color):
def __init__(self, use_color, print_fn=print):
logging.Handler.__init__(self)
self.use_color = use_color
self.__print_fn = print_fn
def emit(self, record):
print(
self.__print_fn(
u'{0}{1}'.format(
color.format_color(
'[{0}]'.format(record.levelname),