add log to http utils.

This commit is contained in:
Miroslav Šedivý 2020-11-14 18:27:20 +01:00
parent 4a5654f2ef
commit 8a9f465d0b

View File

@ -4,6 +4,8 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"encoding/json" "encoding/json"
"github.com/rs/zerolog/log"
) )
type ErrResponse struct { type ErrResponse struct {
@ -24,8 +26,9 @@ func HttpJsonResponse(w http.ResponseWriter, status int, res interface{}) {
w.WriteHeader(status) w.WriteHeader(status)
if err := json.NewEncoder(w).Encode(res); err != nil { if err := json.NewEncoder(w).Encode(res); err != nil {
// TODO: Log. log.Warn().Err(err).
//log.Warn().Err(err).Msg("failed writing json error response") Str("module", "http").
Msg("failed writing json error response")
} }
} }