def format(self, record):
levelname = record.levelname<EOL>if levelname == '<STR_LIT>':<EOL><INDENT>levelname = record.levelname = '<STR_LIT>'<EOL><DEDENT>record.asctime = self.formatTime(record, self.datefmt)<EOL>try:  <EOL><INDENT>message = record.getMessage()<EOL><DEDENT>except TypeError:<EOL><INDENT>message = record.msg.format(*record.args)<EOL><DEDENT>record.message = message<EOL>fields = self._fields<EOL>data = { name: getattr(record, name) for name in fields }<EOL>if '<STR_LIT>' in fields and '<STR_LIT>' in fields:  <EOL><INDENT>data['<STR_LIT>'] += '<STR_LIT>'.format(data.pop('<STR_LIT>'))<EOL><DEDENT>s = self.dumps(data)<EOL>if self._highlight:<EOL><INDENT>s = self._highlight(s, get_lexer_by_name('<STR_LIT>'), _term_formatter,<EOL>).rstrip()<EOL><DEDENT>if record.exc_info:<EOL><INDENT>if not record.exc_text:<EOL><INDENT>record.exc_text = self.formatException(record.exc_info)<EOL><DEDENT><DEDENT>if record.exc_text:<EOL><INDENT>if s[-<NUM_LIT:1>:] != "<STR_LIT:\n>":<EOL><INDENT>s = s + "<STR_LIT:\n>"<EOL><DEDENT>s = s + record.exc_text<EOL><DEDENT>if record.stack_info:<EOL><INDENT>if s[-<NUM_LIT:1>:] != "<STR_LIT:\n>":<EOL><INDENT>s = s + "<STR_LIT:\n>"<EOL><DEDENT>s = s + self.formatStack(record.stack_info)<EOL><DEDENT>return s<EOL>
Log color formatting.