go-logging(停止维护了)替换成zap, zap的配置完善优化,gva的日志更换zap后的处理

This commit is contained in:
SliverHorn
2020-09-05 11:55:51 +08:00
parent 14ea27749c
commit e810a08c0e
18 changed files with 104 additions and 181 deletions

View File

@@ -6,6 +6,7 @@ import (
"gin-vue-admin/model"
"gin-vue-admin/service"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
"io/ioutil"
"net/http"
"strconv"
@@ -19,7 +20,7 @@ func OperationRecord() gin.HandlerFunc {
var err error
body, err = ioutil.ReadAll(c.Request.Body)
if err != nil {
global.GVA_LOG.Error("read body from request error:", err)
global.GVA_LOG.Error("read body from request error:", zap.Any("err", err))
} else {
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body))
}
@@ -52,7 +53,7 @@ func OperationRecord() gin.HandlerFunc {
record.Resp = writer.body.String()
if err := service.CreateSysOperationRecord(record); err != nil {
global.GVA_LOG.Error("create operation record error:", err)
global.GVA_LOG.Error("create operation record error:", zap.Any("err", err))
}
}
}