From d7f7c301b4324f3deb659cd83723982587d99414 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Tue, 14 Feb 2012 20:54:06 -0800 Subject: [PATCH] Using the stream handler and just using our custom color printer. --- conf/logging.ini | 4 ++-- devstack/colorlog.py | 21 --------------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/conf/logging.ini b/conf/logging.ini index cd55297e..dc771111 100644 --- a/conf/logging.ini +++ b/conf/logging.ini @@ -14,9 +14,9 @@ formatter=form01 keys=hand01 [handler_hand01] -class=devstack.colorlog.TermHandler +class=devstack.log.StreamHandler formatter=form01 -args=() +args=(sys.stdout,) [formatters] keys=form01 diff --git a/devstack/colorlog.py b/devstack/colorlog.py index 081ed66a..072a654b 100644 --- a/devstack/colorlog.py +++ b/devstack/colorlog.py @@ -15,11 +15,6 @@ # under the License. import logging -import os -import sys - -#requires http://pypi.python.org/pypi/termcolor -#but the colors make it worth it :-) from termcolor import colored COLOR_MAP = { @@ -48,19 +43,3 @@ class TermFormatter(logging.Formatter): if attrs: record.msg = colored(record.msg, attrs=attrs) return logging.Formatter.format(self, record) - - -class TermHandler(logging.Handler): - STREAM = sys.stdout - DO_FLUSH = True - NL = os.linesep - - def __init__(self): - logging.Handler.__init__(self) - - def emit(self, record): - msg = self.format(record) - if msg is not None: - TermHandler.STREAM.write(msg + TermHandler.NL) - if TermHandler.DO_FLUSH: - TermHandler.STREAM.flush()