Adding traffic in and out to color_map

This commit is contained in:
Miroslav Stampar 2012-07-11 20:42:18 +02:00
parent 43cac2212b
commit 15ee5310d9
2 changed files with 3 additions and 1 deletions

View File

@ -700,7 +700,7 @@ def setColor(message, bold=False):
level = extractRegexResult(r"\A\s*\[(?P<result>[A-Z ]+)\]", message)
if hasattr(LOGGER_HANDLER, "level_map"):
_ = LOGGER_HANDLER.level_map.get(logging._levelNames.get(level))
_ = LOGGER_HANDLER.level_map.get(logging.getLevelName(level))
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

@ -21,6 +21,8 @@ LOGGER = logging.getLogger("sqlmapLog")
try:
import ctypes
LOGGER_HANDLER = ColorizingStreamHandler(sys.stdout)
LOGGER_HANDLER.level_map[logging.getLevelName("TRAFFIC OUT")] = (None, "cyan", True)
LOGGER_HANDLER.level_map[logging.getLevelName("TRAFFIC IN")] = (None, "grey", True)
except ImportError:
LOGGER_HANDLER = logging.StreamHandler(sys.stdout)