1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

refactor: logging (resolve #169)

This commit is contained in:
Ferdinand Mütsch
2021-04-16 15:59:39 +02:00
parent 337b39481b
commit dca736752e
11 changed files with 122 additions and 65 deletions

View File

@@ -2,7 +2,7 @@ package utils
import (
"encoding/json"
"github.com/emvi/logbuch"
"github.com/muety/wakapi/config"
"net/http"
)
@@ -10,6 +10,6 @@ func RespondJSON(w http.ResponseWriter, status int, object interface{}) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(status)
if err := json.NewEncoder(w).Encode(object); err != nil {
logbuch.Error("error while writing json response: %v", err)
config.Log().Error("error while writing json response: %v", err)
}
}