repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
ab9f748
parent
7271cb3
author
Eric Bower
date
2024-02-25 03:14:15 +0000 UTC
chore(pgs): cleanup logs
1 files changed,  +16, -11
M filehandlers/assets/handler.go
+16, -11
 1@@ -208,9 +208,17 @@ func (h *UploadAssetHandler) Validate(s ssh.Session) error {
 2 		return err
 3 	}
 4 	s.Context().SetValue(ctxStorageSizeKey{}, totalStorageSize)
 5-	h.Cfg.Logger.Info("bucket size is current (%d bytes)", "user", user.Name, "size", fmt.Sprintf("%d bytes", totalStorageSize))
 6+	h.Cfg.Logger.Info(
 7+		"bucket size",
 8+		"user", user.Name,
 9+		"bytes", totalStorageSize,
10+	)
11 
12-	h.Cfg.Logger.Info("attempting to upload files", "user", user.Name, "space", h.Cfg.Space)
13+	h.Cfg.Logger.Info(
14+		"attempting to upload files",
15+		"user", user.Name,
16+		"space", h.Cfg.Space,
17+	)
18 
19 	return nil
20 }
21@@ -246,18 +254,18 @@ func (h *UploadAssetHandler) Write(s ssh.Session, entry *utils.FileEntry) (strin
22 		if err == nil {
23 			err = h.DBPool.UpdateProject(user.ID, projectName)
24 			if err != nil {
25-				h.Cfg.Logger.Error(err.Error())
26+				h.Cfg.Logger.Error("could not update project", "err", err.Error())
27 				return "", err
28 			}
29 		} else {
30 			_, err = h.DBPool.InsertProject(user.ID, projectName, projectName)
31 			if err != nil {
32-				h.Cfg.Logger.Error(err.Error())
33+				h.Cfg.Logger.Error("could not create project", "err", err.Error())
34 				return "", err
35 			}
36 			project, err = h.DBPool.FindProjectByName(user.ID, projectName)
37 			if err != nil {
38-				h.Cfg.Logger.Error(err.Error())
39+				h.Cfg.Logger.Error("could not find project", "err", err.Error())
40 				return "", err
41 			}
42 		}
43@@ -383,12 +391,9 @@ func (h *UploadAssetHandler) writeAsset(data *FileData) error {
44 
45 		h.Cfg.Logger.Info(
46 			"uploading file to bucket",
47-			"user",
48-			data.User.Name,
49-			"bucket",
50-			data.Bucket.Name,
51-			"filename",
52-			assetFilename,
53+			"user", data.User.Name,
54+			"bucket", data.Bucket.Name,
55+			"filename", assetFilename,
56 		)
57 
58 		_, err := h.Storage.PutObject(