Browse Source

rm logger suger

master
黄梓健 5 years ago
parent
commit
48d77d991e
  1. 10
      connect/node.go

10
connect/node.go

@ -4,8 +4,8 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/rs/zerolog/log"
"gopkg.in/olahol/melody.v1"
"hudongzhuanjia/logger"
"strings"
"sync"
)
@ -48,7 +48,7 @@ func NewNode() *Node {
}
func (t *Node) handleMelodyConnect(client *Client) {
logger.Sugar.Infof("[websocket] [connect] [room:%s] [client:%s] %s", client.RoomId, client.Id, client.Request.URL)
log.Printf("[websocket] [connect] [room:%s] [client:%s] %s\n", client.RoomId, client.Id, client.Request.URL)
}
// 处理msg
@ -61,7 +61,7 @@ func (t *Node) handleMelodyMessage(client *Client, msg *Message) {
if fn, ok := t.handles[msg.Type]; ok {
fn(client, msg)
}
logger.Sugar.Infof("[websocket] [message] [room:%s] [client:%s] %v", client.RoomId, client.Id, msg)
log.Printf("[websocket] [message] [room:%s] [client:%s] %v\n", client.RoomId, client.Id, msg)
}
// 删掉注册的
@ -102,7 +102,7 @@ func (t *Node) handleMelodyDisconnect(client *Client) {
t.DeleteRoom(room.Id)
}
}
logger.Sugar.Infof("[websocket] [disconnect] [room:%s] [client:%s] online=>%v", client.RoomId, client.Id, client.Online)
log.Printf("[websocket] [disconnect] [room:%s] [client:%s] online=>%v\n", client.RoomId, client.Id, client.Online)
}
func (t *Node) RegisterLogic(name string, fn logic) {
@ -143,7 +143,7 @@ func (t *Node) Send(msg *Message) {
} else if msg.Dest != 0 && msg.Tag != "" {
t.BroadcastDest(msg)
} else {
logger.Sugar.Infof("[websocket] [send] msg=>%v", msg)
log.Printf("[websocket] [send] msg=>%v", msg)
}
}

Loading…
Cancel
Save