新增错误日志

This commit is contained in:
boyce
2019-08-20 20:40:23 +08:00
parent 2f4f111f26
commit b23cd6890e

View File

@@ -109,9 +109,12 @@ func (slf *BaseModule) GetModuleCount() int {
}
func (slf *BaseModule) genModuleId() uint32 {
slf.CurrMaxModuleId++
slf.CurrMaxModuleId = slf.CurrMaxModuleId + 1
moduleId := slf.CurrMaxModuleId
if moduleId == 0 {
GetLogger().Printf(LEVER_ERROR, "%T Cannot AddModule %T is zero", slf.GetSelf(), module.GetSelf())
}
return moduleId
}
@@ -211,8 +214,10 @@ func (slf *BaseModule) AddModule(module IModule) uint32 {
defer locker.Unlock()
//如果没有设置自动生成ModuleId
var genid uint32
if module.GetModuleId() == 0 {
module.SetModuleId(slf.genModuleId())
genid = slf.genModuleId()
module.SetModuleId(genid)
}
module.getBaseModule().selfModule = module
@@ -234,6 +239,7 @@ func (slf *BaseModule) AddModule(module IModule) uint32 {
}
_, ok := slf.mapModule[module.GetModuleId()]
if ok == true {
GetLogger().Printf(LEVER_ERROR, "check mapModule %#v id is %d ,%d is fail...", module, module.GetModuleId(),genid)
return 0
}