add logging
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
5089535fce
commit
e1aff8d16b
7 changed files with 73 additions and 33 deletions
|
|
@ -4,7 +4,7 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"log"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ func (h *SyncHandler) Trigger(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
go func() {
|
||||
if err := h.svc.ScanRepo(context.Background(), repoID); err != nil {
|
||||
log.Printf("scan repo %d: %v", repoID, err)
|
||||
slog.Warn("scan repo failed", "repo_id", repoID, "error", err)
|
||||
}
|
||||
}()
|
||||
JSON(w, http.StatusAccepted, map[string]string{"status": "scan started"})
|
||||
|
|
@ -85,7 +85,7 @@ func (h *SyncHandler) Approve(w http.ResponseWriter, r *http.Request) {
|
|||
ids := req.IDs
|
||||
go func() {
|
||||
if err := h.svc.ApprovePending(context.Background(), repoID, ids); err != nil {
|
||||
log.Printf("approve pending for repo %d: %v", repoID, err)
|
||||
slog.Warn("approve pending failed", "repo_id", repoID, "error", err)
|
||||
}
|
||||
}()
|
||||
JSON(w, http.StatusAccepted, map[string]string{"status": "approval started"})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue