Log color formatting.

def format(self, record):
        ''' Log color formatting. '''
        levelname = record.levelname    # len7 limit
        if levelname == 'CRITICAL':
            levelname = record.levelname = 'FATAL'
        if self.usesTime():
            record.asctime = self.formatTime(record, self.datefmt)

        # render the message part with arguments
        try:  # Allow {} style - need a faster way to determine this:
            message = record.getMessage()
        except TypeError:
            message = record.msg.format(*record.args)

        # decide to highlight w/ pygments
        # TODO: Highlight args directly and drop text scan? - didn't work well.
        if self._highlight:
            match = self.data_search(message, 0, DATA_SEARCH_LIMIT)
            if match:
                pos = match.start()
                front, back = message[:pos], message[pos:]  # Spliten-Sie
                if front.endswith('\n'):                    # indent data?
                    back = pformat(record.args)
                    back = left_indent(back, self._code_indent)
                back = self._highlight(back, self._lexer, self._hl_formatter)
                message = f'{front}{back}'

        record.message = message
        record.on = self._theme_style.get(levelname, '')
        record.icon = self._theme_icons.get(levelname, '')
        record.off = _end
        s = self.formatMessage(record)

        # this needs to be here, Formatter class isn't very extensible.
        if record.exc_info:
            # Cache the traceback text to avoid converting it multiple times
            # (it's constant anyway)
            if not record.exc_text:
                record.exc_text = self.formatException(record.exc_info)
        if record.exc_text:
            if s[-1:] != "\n":
                s = s + "\n"
            s = s + record.exc_text
        if record.stack_info:
            if s[-1:] != "\n":
                s = s + "\n"
            s = s + self.formatStack(record.stack_info)
        return s