From dcc5ef047c8514761ce6b86c64ef6ace86567367 Mon Sep 17 00:00:00 2001 From: 1 <1@72wo.cn> Date: Sat, 26 Jul 2025 03:15:58 +0000 Subject: [PATCH] =?UTF-8?q?"refactor(logging):=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=89=93=E5=8D=B0=E8=AF=AD=E5=8F=A5=EF=BC=8C?= =?UTF-8?q?=E4=BD=BF=E7=94=A8gf=E6=97=A5=E5=BF=97=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/cool/global.go | 1 - common/data/entity/conn.go | 6 ++++-- common/data/entity/wscodec.go | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) 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 }