update logger

This commit is contained in:
2020-08-04 15:19:12 +10:00
parent 61d3fe495b
commit 7172c70b3a
3 changed files with 5 additions and 2 deletions
+1
View File
@@ -10,6 +10,7 @@ require (
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/common v0.10.0
github.com/sirupsen/logrus v1.4.2
golang.org/x/image v0.0.0-20200618115811-c13761719519 // indirect
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect
google.golang.org/protobuf v1.25.0 // indirect
+1
View File
@@ -114,6 +114,7 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT
github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+3 -2
View File
@@ -21,6 +21,7 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/common/model"
logrus "github.com/sirupsen/logrus"
)
const (
@@ -91,7 +92,7 @@ func main() {
r.GET("/svg/:name", func(c *gin.Context) {
if err := generateSVG(client, c); err != nil {
fmt.Println(err.Error())
logrus.Error(err.Error())
if err == ErrNoSuchBadgeFound {
c.JSON(http.StatusNotFound, gin.H{"error": err.Error()})
return
@@ -103,7 +104,7 @@ func main() {
r.GET("/png/:name", func(c *gin.Context) {
if err := generateBadge(client, c); err != nil {
fmt.Println(err.Error())
logrus.Error(err.Error())
}
})