diff --git a/common/cool/global.go b/common/cool/global.go index 5857451c..15e5bbc1 100644 --- a/common/cool/global.go +++ b/common/cool/global.go @@ -39,5 +39,4 @@ func ConutPlayer() int { return true // 继续遍历 }) return count - //fmt.Println("元素数量:", count) // 输出: 3 } diff --git a/common/data/entity/conn.go b/common/data/entity/conn.go index c177aaaf..897ffd30 100644 --- a/common/data/entity/conn.go +++ b/common/data/entity/conn.go @@ -1,10 +1,11 @@ package entity import ( - "fmt" + "context" "github.com/gobwas/ws" "github.com/gobwas/ws/wsutil" + "github.com/gogf/gf/v2/frame/g" "github.com/panjf2000/gnet/v2" "github.com/panjf2000/gnet/v2/pkg/logging" ) @@ -28,7 +29,8 @@ func (c *Conn) SendPack(bytes []byte) error { _, err := c.MainConn.Write(bytes) if err != nil { - fmt.Println(err) + g.Log().Error(context.Background(), err) + } } return nil diff --git a/common/data/entity/wscodec.go b/common/data/entity/wscodec.go index 841e588a..6a0b130b 100644 --- a/common/data/entity/wscodec.go +++ b/common/data/entity/wscodec.go @@ -3,7 +3,6 @@ package entity import ( "bytes" "errors" - "fmt" "io" "github.com/gobwas/ws" @@ -137,7 +136,7 @@ func (w *WsCodec) readWsMessages() (messages []wsutil.Message, err error) { // 从 in 中读出 data,并将 data bytes 写入 msgBuf.cachedBuf if dataLen > 0 { if in.Len() < dataLen { //数据不完整 - fmt.Println(in.Len(), dataLen) + logging.Infof("incomplete data") return }