优化日志

This commit is contained in:
boyce
2024-05-27 18:09:37 +08:00
parent 90d54bf3e2
commit d1935b1bbc

View File

@@ -129,7 +129,7 @@ func (slf *WSClient) Run() {
for{ for{
bytes,err := slf.wsConn.ReadMsg() bytes,err := slf.wsConn.ReadMsg()
if err != nil { if err != nil {
log.Debug("read client id %d is error:%+v",slf.id,err) log.Debug("read client id %s is error:%+v",slf.id,err)
break break
} }
data,err:=slf.wsService.process.Unmarshal(slf.id,bytes) data,err:=slf.wsService.process.Unmarshal(slf.id,bytes)
@@ -153,7 +153,7 @@ func (ws *WSService) SendMsg(clientid string,msg interface{}) error{
client,ok := ws.mapClient[clientid] client,ok := ws.mapClient[clientid]
if ok == false{ if ok == false{
ws.mapClientLocker.Unlock() ws.mapClientLocker.Unlock()
return fmt.Errorf("client %d is disconnect!",clientid) return fmt.Errorf("client %s is disconnect!",clientid)
} }
ws.mapClientLocker.Unlock() ws.mapClientLocker.Unlock()