def format(self, record: logging.LogRecord) -> str:
        """Format the log record as JSON.

        Args:
        ----
            record (logging.LogRecord): The log record to format

        Returns:
        -------
            str: JSON-formatted log message

        """
        # Base log structure
        log_entry = {
            "timestamp": datetime.fromtimestamp(record.created).isoformat(),
            "level": record.levelname,
            "logger": record.name,
            "message": record.getMessage(),
            "module": self._get_module_path(record),
            "function": record.funcName,
            "line": record.lineno,
        }

        # Add custom dimensions if they exist
        if hasattr(record, "custom_dimensions") and record.custom_dimensions:
            log_entry["custom_dimensions"] = record.custom_dimensions

        # Add any other extra fields (excluding custom_dimensions to avoid duplication)
        if hasattr(record, "__dict__"):
            for key, value in record.__dict__.items():
                if key not in {
                    "name",
                    "msg",
                    "args",
                    "levelname",
                    "levelno",
                    "pathname",
                    "filename",
                    "module",
                    "lineno",
                    "funcName",
                    "created",
                    "msecs",
                    "relativeCreated",
                    "thread",
                    "threadName",
                    "processName",
                    "process",
                    "getMessage",
                    "custom_dimensions",
                    "exc_info",
                    "exc_text",
                    "stack_info",
                }:
                    # Only add serializable values
                    try:
                        json.dumps(value)
                        log_entry[key] = value
                    except (TypeError, ValueError):
                        log_entry[key] = str(value)

        # Add exception info if present
        if record.exc_info:
            log_entry["exception"] = self.formatException(record.exc_info)

        return json.dumps(log_entry, default=str)
Format the log record as JSON.

        Args:
        ----
            record (logging.LogRecord): The log record to format

        Returns:
        -------
            str: JSON-formatted log message

        
backend/airweave/core/logging.py