def format(self, record):
        try:
            msg = super(ANSIFormatter, self).format(record)
        except:
            # for python2.6
            # Formatter is old-style class in python2.6 and type is classobj
            # another trick: http://stackoverflow.com/a/18392639/1276501
            msg = Formatter.format(self, record)

        lvl2color = {
            "DEBUG": "blue",
            "INFO": "green",
            "WARNING": "yellow",
            "ERROR": "red",
            "CRITICAL": "bgred"
        }

        rln = record.levelname
        if rln in lvl2color:
            return "[{0}]: {1}".format(
                utils.color_msg(lvl2color[rln], rln),
                msg
            )
        else:
            return msg
dataset/ETHPy150Open tankywoo/simiki/simiki/log.py/ANSIFormatter.format/original