日志优化

This commit is contained in:
liwei1dao 2023-03-30 15:25:48 +08:00
parent 1b5d5b0a6a
commit cc6f8c05d5
2 changed files with 5 additions and 9 deletions

View File

@ -4,7 +4,6 @@ import (
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event" "go_dreamfactory/lego/sys/event"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -69,10 +68,7 @@ func (this *Equipment) OnInstallComp() {
//Event------------------------------------------------------------------------------------------------------------ //Event------------------------------------------------------------------------------------------------------------
func (this *Equipment) EventUserOffline(uid, sessionid string) { func (this *Equipment) EventUserOffline(uid, sessionid string) {
if err := this.modelEquipment.BatchDelLists(uid); err != nil { this.modelEquipment.BatchDelLists(uid)
this.Error("EventUserOffline", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
}
} }
//IEquipment------------------------------------------------------------------------------------------------------------------------------- //IEquipment-------------------------------------------------------------------------------------------------------------------------------

View File

@ -311,14 +311,14 @@ func (this *ModuleBase) CheckRes(session comm.IUserSession, res []*cfg.Gameatn)
for k, v := range attrs { for k, v := range attrs {
if this.ModuleUser.QueryAttributeValue(session.GetUserId(), k) < int64(v) { if this.ModuleUser.QueryAttributeValue(session.GetUserId(), k) < int64(v) {
code = pb.ErrorCode_ResNoEnough code = pb.ErrorCode_ResNoEnough
this.Warnf("资源不足", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "T", Value: k}, log.Field{Key: "N", Value: v}) this.Warn("资源不足", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "T", Value: k}, log.Field{Key: "N", Value: v})
return return
} }
} }
for k, v := range items { //校验消费资源是否充足 for k, v := range items { //校验消费资源是否充足
if int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), k)) < v { if int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), k)) < v {
code = pb.ErrorCode_ResNoEnough code = pb.ErrorCode_ResNoEnough
this.Warnf("道具不足", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "T", Value: k}, log.Field{Key: "N", Value: v}) this.Warn("道具不足", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "T", Value: k}, log.Field{Key: "N", Value: v})
return return
} }
} }
@ -350,14 +350,14 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
for k, v := range attrs { for k, v := range attrs {
if this.ModuleUser.QueryAttributeValue(session.GetUserId(), k) < -int64(v) { // -v 负负得正 if this.ModuleUser.QueryAttributeValue(session.GetUserId(), k) < -int64(v) { // -v 负负得正
code = pb.ErrorCode_ResNoEnough code = pb.ErrorCode_ResNoEnough
this.Warnf("资源不足", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "T", Value: k}, log.Field{Key: "N", Value: v}) this.Warn("资源不足", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "T", Value: k}, log.Field{Key: "N", Value: v})
return return
} }
} }
for k, v := range items { for k, v := range items {
if int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), k)) < -v { if int32(this.ModuleItems.QueryItemAmount(session.GetUserId(), k)) < -v {
code = pb.ErrorCode_ResNoEnough code = pb.ErrorCode_ResNoEnough
this.Warnf("道具不足", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "T", Value: k}, log.Field{Key: "N", Value: v}) this.Warn("道具不足", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "T", Value: k}, log.Field{Key: "N", Value: v})
return return
} }
} }