Monorepo for Tangled tangled.org
763
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview/issues: replace log.Println with structured logging in opengraph.go

Signed-off-by: Matías Insaurralde <matias@insaurral.de>

authored by

Matías Insaurralde and committed by
Tangled
e8e4e63b ae44f0db

+5 -6
+5 -6
appview/issues/opengraph.go
··· 3 3 import ( 4 4 "context" 5 5 "fmt" 6 - "log" 7 6 "net/http" 8 7 "time" 9 8 ··· 17 16 func (rp *Issues) IssueOpenGraphSummary(w http.ResponseWriter, r *http.Request) { 18 17 f, err := rp.repoResolver.Resolve(r) 19 18 if err != nil { 20 - log.Println("failed to get repo and knot", err) 19 + rp.logger.Error("failed to get repo and knot", "err", err) 21 20 return 22 21 } 23 22 24 23 issue, ok := r.Context().Value("issue").(*models.Issue) 25 24 if !ok { 26 - log.Println("issue not found in context") 25 + rp.logger.Error("issue not found in context") 27 26 http.Error(w, "issue not found", http.StatusNotFound) 28 27 return 29 28 } ··· 34 33 orm.FilterContains("scope", tangled.RepoIssueNSID), 35 34 ) 36 35 if err != nil { 37 - log.Println("failed to fetch label definitions") 36 + rp.logger.Error("failed to fetch label definitions", "err", err) 38 37 http.Error(w, "label definitions not found", http.StatusInternalServerError) 39 38 return 40 39 } ··· 100 99 101 100 imageBytes, err := rp.ogreClient.RenderIssueCard(r.Context(), payload) 102 101 if err != nil { 103 - log.Println("failed to render issue card", err) 102 + rp.logger.Error("failed to render issue card", "err", err) 104 103 http.Error(w, "failed to render issue card", http.StatusInternalServerError) 105 104 return 106 105 } ··· 110 109 w.WriteHeader(http.StatusOK) 111 110 _, err = w.Write(imageBytes) 112 111 if err != nil { 113 - log.Println("failed to write issue card", err) 112 + rp.logger.Error("failed to write issue card", "err", err) 114 113 return 115 114 } 116 115 }