Skip to content

Commit

Permalink
Only log errors when its an app error. Otherwise just debug the output.
Browse files Browse the repository at this point in the history
  • Loading branch information
tiger5226 committed Dec 8, 2019
1 parent cc380a1 commit a057c86
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion swagger/apiserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ func InitApiServer(hostAndPort string) {
hs["Access-Control-Allow-Origin"] = "*"
api.ResponseHeaders = hs
api.Log = func(request *http.Request, response *api.Response, err error) {
if err != nil {
if response.Status >= http.StatusInternalServerError {
logrus.Error(err)
}
if err != nil {
logrus.Debug("Error: ", err)
}
consoleText := request.RemoteAddr + " [" + strconv.Itoa(response.Status) + "]: " + request.Method + " " + request.URL.Path
logrus.Debug(color.GreenString(consoleText))

Expand Down

0 comments on commit a057c86

Please sign in to comment.