Skip to content

Commit

Permalink
Simplify logging on httpErr
Browse files Browse the repository at this point in the history
Signed-off-by: Riyaz Faizullabhoy <[email protected]>
  • Loading branch information
riyazdf committed Jul 14, 2016
1 parent 4018137 commit a367145
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ func (root *rootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if httpErr, ok := err.(errcode.ErrorCoder); ok {
// info level logging for non-5XX http errors
httpErrCode := httpErr.ErrorCode().Descriptor().HTTPStatusCode
if (httpErrCode < http.StatusOK || httpErrCode >= http.StatusMultipleChoices) && httpErrCode < http.StatusInternalServerError {
log.Info(httpErr)
} else if httpErrCode >= http.StatusInternalServerError {
if httpErrCode >= http.StatusInternalServerError {
// error level logging for 5XX http errors
log.Error(httpErr)
} else {
log.Info(httpErr)
}
}
e := errcode.ServeJSON(w, err)
Expand Down

0 comments on commit a367145

Please sign in to comment.