优化日志输出

This commit is contained in:
liwei1dao 2023-09-15 22:23:36 +08:00
parent 038d417a1d
commit fe682f9f39
7 changed files with 29 additions and 15 deletions

View File

@ -2,6 +2,7 @@ package battle
import ( import (
"fmt" "fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
@ -74,7 +75,8 @@ func (this *configureComp) GetBattleReady(id int32) (conf *cfg.GameBattleReadyDa
return return
} else { } else {
if conf, ok = v.(*cfg.GameBattleReady).GetDataMap()[id]; !ok { if conf, ok = v.(*cfg.GameBattleReady).GetDataMap()[id]; !ok {
err = fmt.Errorf("not found:%d ", id) // err = fmt.Errorf("not found:%d ", id)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_battleready, id)
this.module.Errorln(err) this.module.Errorln(err)
return return
} }
@ -125,7 +127,8 @@ func (this *configureComp) getPandamasBuff(id int32) (configure *cfg.GamePandama
return return
} else { } else {
if configure, ok = v.(*cfg.GamePandamasBuff).GetDataMap()[id]; !ok { if configure, ok = v.(*cfg.GamePandamasBuff).GetDataMap()[id]; !ok {
err = fmt.Errorf("not found:%d ", id) // err = fmt.Errorf("not found:%d ", id)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_pandamasbuff, id)
this.module.Errorln(err) this.module.Errorln(err)
return return
} }

View File

@ -114,7 +114,8 @@ func (this *configureComp) GetEquipmentConfigureById(equipmentId string) (config
return return
} else { } else {
if configure, ok = v.(*cfg.GameEquip).GetDataMap()[equipmentId]; !ok { if configure, ok = v.(*cfg.GameEquip).GetDataMap()[equipmentId]; !ok {
err = fmt.Errorf("EquipmentConfigure not found:%s ", equipmentId) // err = fmt.Errorf("EquipmentConfigure not found:%s ", equipmentId)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_equip, equipmentId)
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} }

View File

@ -388,7 +388,8 @@ func (this *configureComp) GetShopItemsConfigure(key int32) (result *cfg.GameSho
return return
} else { } else {
if result, ok = v.(*cfg.GameShopitem).GetDataMap()[key]; !ok { if result, ok = v.(*cfg.GameShopitem).GetDataMap()[key]; !ok {
err = fmt.Errorf("ShopConfigure not found:%d ", key) // err = fmt.Errorf("ShopConfigure not found:%d ", key)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_shopitem, key)
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} }

View File

@ -1,7 +1,6 @@
package moonfantasy package moonfantasy
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/modules" "go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -64,7 +63,7 @@ func (this *configureComp) GetMonsterById(id string) (result *cfg.GameDreamlandB
return return
} else { } else {
if result, ok = v.(*cfg.GameDreamlandBoos).GetDataMap()[id]; !ok { if result, ok = v.(*cfg.GameDreamlandBoos).GetDataMap()[id]; !ok {
err = fmt.Errorf("not found:%s ", id) err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_dreamlandboos, id)
this.module.Errorln(err) this.module.Errorln(err)
return return
} }
@ -83,7 +82,8 @@ func (this *configureComp) GettriggerData(ptypes int32) (result *cfg.GameDreamla
return return
} else { } else {
if result, ok = v.(*cfg.GameDreamlandTrigger).GetDataMap()[ptypes]; !ok { if result, ok = v.(*cfg.GameDreamlandTrigger).GetDataMap()[ptypes]; !ok {
err = fmt.Errorf("not found:%d ", ptypes) // err = fmt.Errorf("not found:%d ", ptypes)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_dreamlandtrigger, ptypes)
// this.module.Errorln(err) // this.module.Errorln(err)
return return
} }

View File

@ -2,6 +2,7 @@ package parkour
import ( import (
"fmt" "fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
@ -66,7 +67,8 @@ func (this *configureComp) getGameBuzkashiReward(id int32) (configure *cfg.GameB
if v, err := this.GetConfigure(game_buzkashireward); err == nil { if v, err := this.GetConfigure(game_buzkashireward); err == nil {
var ok bool var ok bool
if configure, ok = v.(*cfg.GameBuzkashiReward).GetDataMap()[id]; !ok { if configure, ok = v.(*cfg.GameBuzkashiReward).GetDataMap()[id]; !ok {
err = fmt.Errorf("not found:%d ", id) // err = fmt.Errorf("not found:%d ", id)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_buzkashireward, id)
this.module.Errorln(err) this.module.Errorln(err)
return return
} }

View File

@ -82,7 +82,8 @@ func (this *configureComp) getGamePandamasMz(lv int32) (configure *cfg.GamePanda
return return
} else { } else {
if configure, ok = v.(*cfg.GamePandamasMz).GetDataMap()[lv]; !ok { if configure, ok = v.(*cfg.GamePandamasMz).GetDataMap()[lv]; !ok {
err = fmt.Errorf("not found:%d ", lv) // err = fmt.Errorf("not found:%d ", lv)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_pandamasmz, lv)
this.module.Errorln(err) this.module.Errorln(err)
return return
} }
@ -113,7 +114,8 @@ func (this *configureComp) getGamePandamasJx(id string) (configure *cfg.GamePand
return return
} else { } else {
if configure, ok = v.(*cfg.GamePandamasJx).GetDataMap()[id]; !ok { if configure, ok = v.(*cfg.GamePandamasJx).GetDataMap()[id]; !ok {
err = fmt.Errorf("not found:%s ", id) // err = fmt.Errorf("not found:%s ", id)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_pandamasjx, id)
this.module.Errorln(err) this.module.Errorln(err)
return return
} }
@ -131,7 +133,8 @@ func (this *configureComp) getGamePandamasYxjx(id int32) (configure *cfg.GamePan
return return
} else { } else {
if configure, ok = v.(*cfg.GamePandamasYxjx).GetDataMap()[id]; !ok { if configure, ok = v.(*cfg.GamePandamasYxjx).GetDataMap()[id]; !ok {
err = fmt.Errorf("not found:%d", id) // err = fmt.Errorf("not found:%d", id)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_pandamasyxjx, id)
this.module.Errorln(err) this.module.Errorln(err)
return return
} }
@ -162,7 +165,8 @@ func (this *configureComp) getPandamasMryl(id int32) (configure *cfg.GamePandama
return return
} else { } else {
if configure, ok = v.(*cfg.GamePandamasMryl).GetDataMap()[id]; !ok { if configure, ok = v.(*cfg.GamePandamasMryl).GetDataMap()[id]; !ok {
err = fmt.Errorf("not found:%d ", id) // err = fmt.Errorf("not found:%d ", id)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_pandamasmryl, id)
this.module.Errorln(err) this.module.Errorln(err)
return return
} }
@ -220,7 +224,8 @@ func (this *configureComp) getDispatchBattleData(id int32) (configure *cfg.GameD
return return
} else { } else {
if configure, ok = v.(*cfg.GameDispatch_Battle).GetDataMap()[id]; !ok { if configure, ok = v.(*cfg.GameDispatch_Battle).GetDataMap()[id]; !ok {
err = fmt.Errorf("not found:%d ", id) // err = fmt.Errorf("not found:%d ", id)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_dispatch_battle, id)
this.module.Errorln(err) this.module.Errorln(err)
return return
} }

View File

@ -44,7 +44,8 @@ func (this *configureComp) GetShopConfigure(id int32) (configure *cfg.GameShopDa
return return
} else { } else {
if configure, ok = v.(*cfg.GameShop).GetDataMap()[id]; !ok { if configure, ok = v.(*cfg.GameShop).GetDataMap()[id]; !ok {
err = fmt.Errorf("ShopConfigure not found:%d ", id) // err = fmt.Errorf("ShopConfigure not found:%d ", id)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_shop, id)
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} }
@ -63,7 +64,8 @@ func (this *configureComp) GetShopItemsConfigure(key int32) (result *cfg.GameSho
return return
} else { } else {
if result, ok = v.(*cfg.GameShopitem).GetDataMap()[key]; !ok { if result, ok = v.(*cfg.GameShopitem).GetDataMap()[key]; !ok {
err = fmt.Errorf("ShopConfigure not found:%d ", key) // err = fmt.Errorf("ShopConfigure not found:%d ", key)
err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_shopitem, key)
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} }