mirror of
https://github.com/simon987/task_tracker.git
synced 2025-12-14 07:19:02 +00:00
Web dashboard, task release, logs api
This commit is contained in:
@@ -2,7 +2,6 @@ package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
@@ -11,7 +10,6 @@ type Request struct {
|
||||
Ctx *fasthttp.RequestCtx
|
||||
}
|
||||
|
||||
|
||||
func (r *Request) OkJson(object interface{}) {
|
||||
|
||||
resp, err := json.Marshal(object)
|
||||
@@ -26,8 +24,9 @@ func (r *Request) Json(object interface{}, code int) {
|
||||
|
||||
resp, err := json.Marshal(object)
|
||||
if err != nil {
|
||||
fmt.Fprint(r.Ctx,"Error during json encoding of error")
|
||||
logrus.Error("Error during json encoding of error")
|
||||
logrus.WithError(err).WithFields(logrus.Fields{
|
||||
"code": code,
|
||||
}).Error("Error during json encoding of object")
|
||||
}
|
||||
|
||||
r.Ctx.Response.SetStatusCode(code)
|
||||
|
||||
Reference in New Issue
Block a user