Web dashboard, task release, logs api

This commit is contained in:
simon987
2019-01-21 20:16:30 -05:00
parent 0346dd8b6b
commit cbd32daf02
65 changed files with 13430 additions and 114 deletions

View File

@@ -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)