restored kb.currentMessage - needed in cases where we send to dataToStdout() strings like "." (e.g. "creation in progres ..... done")

This commit is contained in:
Bernardo Damele 2012-07-11 22:48:27 +01:00
parent 2b3ea3e3b7
commit 247f95e051
2 changed files with 7 additions and 3 deletions

View File

@ -697,10 +697,13 @@ def singleTimeLogMessage(message, level=logging.INFO, flag=None):
def setColor(message, bold=False):
retVal = message
level = extractRegexResult(r"\A\s*\[(?P<result>[A-Z ]+)\]", message)
level = extractRegexResult(r"\[(?P<result>[A-Z ]+)\]", message)
if hasattr(LOGGER_HANDLER, "level_map"):
_ = LOGGER_HANDLER.level_map.get(logging.getLevelName(level))
if level:
kb.currentMessage = level
if hasattr(LOGGER_HANDLER, "level_map") and hasattr(kb, "currentMessage") and kb.currentMessage:
_ = LOGGER_HANDLER.level_map.get(logging.getLevelName(kb.currentMessage))
if _:
background, foreground, bold = _
retVal = colored(message, color=foreground, on_color="on_%s" % background if background else None, attrs=("bold",) if bold else None)

View File

@ -1436,6 +1436,7 @@ def __setKnowledgeBaseAttributes(flushAll=True):
kb.commonOutputs = None
kb.counters = {}
kb.currentMessage = None
kb.data = AttribDict()
kb.dataOutputFlag = False