def __init__(self, use_colors):
logging.Handler.__init__(self)
self.use_colors = use_colors
# Initialize environment
curses.setupterm()
# Get the foreground color attribute for this environment
self.fcap = curses.tigetstr('setaf')
# Get the normal attribute
self.COLOR_NORMAL = curses.tigetstr('sgr0').decode("utf-8")
# Get + Save the color sequences
self.COLOR_INFO = curses.tparm(self.fcap, curses.COLOR_GREEN).decode("utf-8")
self.COLOR_ERROR = curses.tparm(self.fcap, curses.COLOR_RED).decode("utf-8")
self.COLOR_WARNING = curses.tparm(self.fcap, curses.COLOR_YELLOW).decode("utf-8")
self.COLOR_DEBUG = curses.tparm(self.fcap, curses.COLOR_BLUE).decode("utf-8")
评论列表
文章目录