mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add log to http utils.
This commit is contained in:
parent
4a5654f2ef
commit
8a9f465d0b
@ -4,6 +4,8 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
type ErrResponse struct {
|
||||
@ -24,8 +26,9 @@ func HttpJsonResponse(w http.ResponseWriter, status int, res interface{}) {
|
||||
w.WriteHeader(status)
|
||||
|
||||
if err := json.NewEncoder(w).Encode(res); err != nil {
|
||||
// TODO: Log.
|
||||
//log.Warn().Err(err).Msg("failed writing json error response")
|
||||
log.Warn().Err(err).
|
||||
Str("module", "http").
|
||||
Msg("failed writing json error response")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user