minor fix in case ctypes is not installed on Windows

This commit is contained in:
Bernardo Damele 2012-07-10 13:08:37 +01:00
parent 8caffac4bc
commit f219b39980

View File

@ -17,8 +17,13 @@ logging.addLevelName(CUSTOM_LOGGING.TRAFFIC_OUT, "TRAFFIC OUT")
logging.addLevelName(CUSTOM_LOGGING.TRAFFIC_IN, "TRAFFIC IN") logging.addLevelName(CUSTOM_LOGGING.TRAFFIC_IN, "TRAFFIC IN")
LOGGER = logging.getLogger("sqlmapLog") LOGGER = logging.getLogger("sqlmapLog")
#LOGGER_HANDLER = logging.StreamHandler(sys.stdout)
LOGGER_HANDLER = ColorizingStreamHandler(sys.stdout) try:
import ctypes
LOGGER_HANDLER = ColorizingStreamHandler(sys.stdout)
except ImportError:
LOGGER_HANDLER = logging.StreamHandler(sys.stdout)
FORMATTER = logging.Formatter("\r[%(asctime)s] [%(levelname)s] %(message)s", "%H:%M:%S") FORMATTER = logging.Formatter("\r[%(asctime)s] [%(levelname)s] %(message)s", "%H:%M:%S")
LOGGER_HANDLER.setFormatter(FORMATTER) LOGGER_HANDLER.setFormatter(FORMATTER)