From ea77e7d9d101a62b92ac76b7492bd707e8c0388b Mon Sep 17 00:00:00 2001 From: Bernardo Damele Date: Tue, 10 Jul 2012 03:00:21 +0100 Subject: [PATCH] added missing file - issue #77 --- lib/core/log.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/core/log.py diff --git a/lib/core/log.py b/lib/core/log.py new file mode 100644 index 000000000..7add4431e --- /dev/null +++ b/lib/core/log.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +""" +Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) +See the file 'doc/COPYING' for copying permission +""" + +import logging +import sys + +from extra.ansistrm.ansistrm import ColorizingStreamHandler +from lib.core.enums import CUSTOM_LOGGING + +# sqlmap logger +logging.addLevelName(CUSTOM_LOGGING.PAYLOAD, "PAYLOAD") +logging.addLevelName(CUSTOM_LOGGING.TRAFFIC_OUT, "TRAFFIC OUT") +logging.addLevelName(CUSTOM_LOGGING.TRAFFIC_IN, "TRAFFIC IN") + +LOGGER = logging.getLogger("sqlmapLog") +#LOGGER_HANDLER = logging.StreamHandler(sys.stdout) +LOGGER_HANDLER = ColorizingStreamHandler(sys.stdout) +FORMATTER = logging.Formatter("\r[%(asctime)s] [%(levelname)s] %(message)s", "%H:%M:%S") + +LOGGER_HANDLER.setFormatter(FORMATTER) +LOGGER.addHandler(LOGGER_HANDLER) +LOGGER.setLevel(logging.WARN)