调整log代码,兼容zap扩展支持fields

This commit is contained in:
linwenxiang committed 2021-03-05 15:13:36 +08:00
1 parent 39dd1ee6f8
commit 75711922b4
47 files changed
+267 -275

No files matched your search

+13 -13
View File
@@ -1,14 +1,14 @@
package dto
import (
"go-admin/common/apis"
"time"
"github.com/gin-gonic/gin"
log "github.com/go-admin-team/go-admin-core/logger"
"go-admin/app/admin/models/system"
"go-admin/common/dto"
common "go-admin/common/models"
"go-admin/tools"
"time"
)
type SysOperaLogSearch struct {
@@ -26,10 +26,10 @@ func (m *SysOperaLogSearch) GetNeedSearch() interface{} {
}
func (m *SysOperaLogSearch) Bind(ctx *gin.Context) error {
msgID := tools.GenerateMsgIDFromContext(ctx)
log := apis.GetRequestLogger(ctx)
err := ctx.ShouldBind(m)
if err != nil {
log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error())
log.Debugf("ShouldBind error: %s", err.Error())
}
return err
}
@@ -57,15 +57,15 @@ type SysOperaLogControl struct {
}
func (s *SysOperaLogControl) Bind(ctx *gin.Context) error {
msgID := tools.GenerateMsgIDFromContext(ctx)
log := apis.GetRequestLogger(ctx)
err := ctx.ShouldBindUri(s)
if err != nil {
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
log.Debugf("ShouldBindUri error: %s", err.Error())
return err
}
err = ctx.ShouldBind(s)
if err != nil {
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
log.Debugf("ShouldBind error: %s", err.Error())
}
return err
}
@@ -112,19 +112,19 @@ func (s *SysOperaLogById) GetId() interface{} {
}
func (s *SysOperaLogById) Bind(ctx *gin.Context) error {
msgID := tools.GenerateMsgIDFromContext(ctx)
log := apis.GetRequestLogger(ctx)
err := ctx.ShouldBindUri(s)
if err != nil {
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
log.Debugf("ShouldBindUri error: %s", err.Error())
return err
}
err = ctx.ShouldBind(&s.Ids)
if err != nil {
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
log.Debugf("ShouldBind error: %s", err.Error())
}
return err
}
func (s *SysOperaLogById) SetUpdateBy(id int) {
}
}