def METHOD_NAME(self, record):
    if not hasattr(record, "task"):
        record.task = "unknown"
    record.message = record.getMessage()
    record.asctime = self.formatTime(record, self.datefmt)
    s = self._fmt % record.__dict__
    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
    return s