"refactor(logging): 移除调试打印语句,使用gf日志框架记录错误信息"

This commit is contained in:
1
2025-07-26 03:15:58 +00:00
parent 459a779591
commit dcc5ef047c
3 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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
}