:type rec: logging.LogRecord

def format(self, rec):
        """
        :type rec: logging.LogRecord
        """
        t = self.formatTime(rec, self.datefmt)
        func = '' if rec.funcName == '<module>' else ' %s()' % rec.funcName
        left_header_data = (t, rec.msecs, rec.name, func, rec.lineno)
        left_header = '%s.%03d %s%s @ %d' % left_header_data
        right_header = rec.levelname.lower()
        spacer = 79 - 4 - len(left_header) - len(right_header)
        top_line = left_header + ' -' + spacer * '-' + '- ' + right_header
        lines = [_ for __ in textwrap.dedent(rec.getMessage()).splitlines()
                 for _ in self.wrapper.wrap(__)]

        # This is more or less the logic in logging.Formatter.format() for
        # exception logging, though greatly condensed.
        if rec.exc_info:
            exc_text = super(Formatter, self).formatException(rec.exc_info)
            exc_lines = exc_text.splitlines()
            # if len(exc_lines) > 4:
            #     exc_lines = exc_lines[:2] + ['...'] + exc_lines[-2:]
            lines += [''] + ['  ' + l for l in exc_lines]

        return top_line + '\n' + '\n'.join(l for l in lines)