func msgLog(dir string, ses cellnet.Session, pkt *cellnet.Packet) { if !EnableMessageLog { return } info := &MessageLogInfo{ Dir: dir, ses: ses, pkt: pkt, meta: cellnet.MessageMetaByID(pkt.MsgID), } // 找到消息需要屏蔽 if _, ok := msgMetaByID[info.MsgID()]; ok { return } if msgLogHook == nil || (msgLogHook != nil && msgLogHook(info)) { log.Debugf("#%s(%s) sid: %d %s size: %d | %s", info.Dir, info.PeerName(), info.SessionID(), info.MsgName(), info.MsgSize(), info.MsgString()) } }
func getMsgName(msgid uint32) string { if meta := cellnet.MessageMetaByID(msgid); meta != nil { return meta.Name } return "" }