def METHOD_NAME(self, record):
    # Included from Python's logging.Formatter and then altered slightly to
    # replace \n with #012
    record.message = record.getMessage()
    if self.usesTime():
        record.asctime = self.formatTime(record, self.datefmt)
    msg = self.formatMessage(record).replace("\n", "#012")
    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).replace(
                "\n", "#012"
            )
    if record.exc_text:
        if not msg.endswith("#012"):
            msg = msg + "#012"
        msg = msg + record.exc_text
    if record.stack_info:
        if not msg.endswith("#012"):
            msg = msg + "#012"
        msg = msg + self.formatStack(record.stack_info).replace("\n", "#012")
    if self.max_line_length > 0 and len(msg) > self.max_line_length:
        if self.max_line_length < 7:
            msg = msg[: self.max_line_length]
        else:
            approxhalf = (self.max_line_length - 5) // 2
            msg = msg[:approxhalf] + " ... " + msg[-approxhalf:]
    return msg