    def log_record(self, record:logging.LogRecord):
        """Log the record with the logger of the task.
        Also sets the status according to the record.
        """
        # Set last_run/last_success/last_fail etc.
        cache_attr = f"_last_{record.action}"
        record_time = record.created

        try:
            self.logger.handle(record)
        except Exception as exc:
            if record.action == "run":
                # The task started and the run must be set
                # even though the task partly failed already
                setattr(self, cache_attr, record_time)
                self.status = record.action
            else:
                # Logging is part of the task so even if the task
                # function itself succeeded, the task failed
                setattr(self, "_last_fail", record_time)
                self.status = "fail"
            raise TaskLoggingError(f"Logging for task '{self.name}' failed.") from exc
        else:
            setattr(self, cache_attr, record_time)
            self.status = record.action
Log the record with the logger of the task.
Also sets the status according to the record.
rocketry/core/task.py