Skip to content

Commit 3eef933

Browse files
committed
Logging
1 parent ec5f4b0 commit 3eef933

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

backend/internal/handlers/upload.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"fmt"
66
"io"
7+
"log/slog"
78
"net/http"
89
"path/filepath"
910
"strings"
@@ -147,6 +148,7 @@ func (h *UploadHandler) HandleFileUpload(c *gin.Context) {
147148
// Upload to S3
148149
publicURL, err := h.S3Service.UploadFile(ctx, bytes.NewReader(buffer.Bytes()), storedFilename, mimeType, fileSize)
149150
if err != nil {
151+
slog.Error("Failed to upload file to S3", "error", err, "filename", storedFilename, "size", fileSize)
150152
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to upload file to S3"})
151153
return
152154
}
@@ -162,6 +164,7 @@ func (h *UploadHandler) HandleFileUpload(c *gin.Context) {
162164
UploadedBy: userID,
163165
})
164166
if err != nil {
167+
slog.Error("Failed to save file record to database", "error", err, "fileID", fileID)
165168
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to save file record"})
166169
return
167170
}

0 commit comments

Comments
 (0)