Commit cfaf256a authored by hujiebin's avatar hujiebin

feat:去掉日志

parent d4e1afb6
...@@ -2,7 +2,6 @@ package main ...@@ -2,7 +2,6 @@ package main
import ( import (
"context" "context"
"encoding/json"
"flag" "flag"
"fmt" "fmt"
"hilo-userProxy/common" "hilo-userProxy/common"
...@@ -179,18 +178,18 @@ func serverWebsocket(w http.ResponseWriter, r *http.Request) { ...@@ -179,18 +178,18 @@ func serverWebsocket(w http.ResponseWriter, r *http.Request) {
ci.IsLogin = true ci.IsLogin = true
ci.HeartbeatTime = now ci.HeartbeatTime = now
logger.Infof("Bind to channel %v", writeChan) //logger.Infof("Bind to channel %v", writeChan)
setUserChan(ci.Uid, ci.RemoteAddr, writeChan) setUserChan(ci.Uid, ci.RemoteAddr, writeChan)
} }
} }
} }
} else if msgType == common.MsgTypeHeartBeat { } else if msgType == common.MsgTypeHeartBeat {
status, extUid, err := processHeartBeat(pbData) status, extUid, err := processHeartBeat(pbData)
logger.Infof("heartbeat") //logger.Infof("heartbeat")
if err == nil { if err == nil {
ci.HeartbeatTime = time.Now() ci.HeartbeatTime = time.Now()
if len(ci.ExternalId) == 0 { if len(ci.ExternalId) == 0 {
logger.Infof("Received first heartbeat") //logger.Infof("Received first heartbeat")
ci.ExternalId = extUid ci.ExternalId = extUid
...@@ -221,7 +220,7 @@ func serverWebsocket(w http.ResponseWriter, r *http.Request) { ...@@ -221,7 +220,7 @@ func serverWebsocket(w http.ResponseWriter, r *http.Request) {
rsp := &userProxy.GlobalGiftBannerRsp{} rsp := &userProxy.GlobalGiftBannerRsp{}
err := proto.Unmarshal(pbData, rsp) err := proto.Unmarshal(pbData, rsp)
if err == nil { if err == nil {
logger.Infof("GlobalGiftBannerRsp, msgType = %d, %v", msgType, rsp) //logger.Infof("GlobalGiftBannerRsp, msgType = %d, %v", msgType, rsp)
} else { } else {
logger.Errorf("Unmarshal error") logger.Errorf("Unmarshal error")
} }
...@@ -232,7 +231,7 @@ func serverWebsocket(w http.ResponseWriter, r *http.Request) { ...@@ -232,7 +231,7 @@ func serverWebsocket(w http.ResponseWriter, r *http.Request) {
}) })
rsp, err := processBizRequest(logger, ci.Uid, pbData) rsp, err := processBizRequest(logger, ci.Uid, pbData)
if err == nil && rsp != nil { if err == nil && rsp != nil {
logger.Infof("processBizRequest rsp %+v", rsp) //logger.Infof("processBizRequest rsp %+v", rsp)
if buffer, err := proto.Marshal(rsp); err == nil { if buffer, err := proto.Marshal(rsp); err == nil {
writeChan <- ProtoData{ writeChan <- ProtoData{
...@@ -267,15 +266,15 @@ func serverWebsocket(w http.ResponseWriter, r *http.Request) { ...@@ -267,15 +266,15 @@ func serverWebsocket(w http.ResponseWriter, r *http.Request) {
} }
} }
logger.Infof("exiting read loop for token %s, user %d", ci.Token, ci.Uid) logger.Infof("exiting read loop for token %s, user %d", ci.Token, ci.Uid)
sz := removeUserChan(ci.Uid, ci.RemoteAddr) removeUserChan(ci.Uid, ci.RemoteAddr)
b, _ := json.Marshal(ci) //b, _ := json.Marshal(ci)
logger.Infof("exiting read loop for %s, size = %d", string(b), sz) //logger.Infof("exiting read loop for %s, size = %d", string(b), sz)
if ci.IsLogin { if ci.IsLogin {
err, status := doLogout(ci.RemoteAddr, ci.Uid) err, _ := doLogout(ci.RemoteAddr, ci.Uid)
if err == nil { if err == nil {
logger.Printf("logout result %d", status) //logger.Printf("logout result %d", status)
} else { } else {
logger.Printf("Logout failed, %s", err.Error()) logger.Printf("Logout failed, %s", err.Error())
} }
...@@ -341,7 +340,7 @@ Loop: ...@@ -341,7 +340,7 @@ Loop:
} }
atomic.AddUint64(&serialNum, 1) atomic.AddUint64(&serialNum, 1)
logger.Infof("About to send msgType = %d, size = %d", d.MsgType, len(d.Data)) //logger.Infof("About to send msgType = %d, size = %d", d.MsgType, len(d.Data))
data := common.EncodeMessage(d.MsgType, serialNum, d.Data) data := common.EncodeMessage(d.MsgType, serialNum, d.Data)
err = ws.WriteMessage(websocket.BinaryMessage, data) err = ws.WriteMessage(websocket.BinaryMessage, data)
if err != nil { if err != nil {
...@@ -349,8 +348,8 @@ Loop: ...@@ -349,8 +348,8 @@ Loop:
} }
} }
} }
b, _ := json.Marshal(ci) //b, _ := json.Marshal(ci)
logger.Infof("exiting write loop:%s", string(b)) //logger.Infof("exiting write loop:%s", string(b))
} }
func processLogin(logger *log.Entry, clientAddr string, pbData []byte) (string, uint64, *userProxy.LoginRsp, error) { func processLogin(logger *log.Entry, clientAddr string, pbData []byte) (string, uint64, *userProxy.LoginRsp, error) {
...@@ -423,7 +422,7 @@ func processEnterRoom(logger *log.Entry, uid uint64, pbData []byte) error { ...@@ -423,7 +422,7 @@ func processEnterRoom(logger *log.Entry, uid uint64, pbData []byte) error {
if err == nil { if err == nil {
err, status := doEnterRoom(uid, msg.GroupId) err, status := doEnterRoom(uid, msg.GroupId)
if err == nil && status == common.Login_success { if err == nil && status == common.Login_success {
logger.Infof("enter room success,uid:%v,group:%v", uid, msg.GroupId) //logger.Infof("enter room success,uid:%v,group:%v", uid, msg.GroupId)
} else { } else {
logger.Warnf("login RPC failed for %d, %v", status, err) logger.Warnf("login RPC failed for %d, %v", status, err)
} }
...@@ -439,7 +438,7 @@ func processLeaveRoom(logger *log.Entry, uid uint64, pbData []byte) error { ...@@ -439,7 +438,7 @@ func processLeaveRoom(logger *log.Entry, uid uint64, pbData []byte) error {
if err == nil { if err == nil {
err, status := doLeaveRoom(uid, msg.GroupId) err, status := doLeaveRoom(uid, msg.GroupId)
if err == nil && status == common.Login_success { if err == nil && status == common.Login_success {
logger.Infof("leave room success,uid:%v,group:%v", uid, msg.GroupId) //logger.Infof("leave room success,uid:%v,group:%v", uid, msg.GroupId)
} else { } else {
logger.Warnf("login RPC failed for %d, %v", status, err) logger.Warnf("login RPC failed for %d, %v", status, err)
} }
...@@ -455,7 +454,7 @@ func processRoomHeartbeat(logger *log.Entry, uid uint64, pbData []byte) error { ...@@ -455,7 +454,7 @@ func processRoomHeartbeat(logger *log.Entry, uid uint64, pbData []byte) error {
if err == nil { if err == nil {
err, status := doRoomHeartbeat(uid, msg.GroupId) err, status := doRoomHeartbeat(uid, msg.GroupId)
if err == nil && status == common.Login_success { if err == nil && status == common.Login_success {
logger.Infof("room heartbeat success,uid:%v,group:%v", uid, msg.GroupId) //logger.Infof("room heartbeat success,uid:%v,group:%v", uid, msg.GroupId)
} else { } else {
logger.Warnf("login RPC failed for %d, %v", status, err) logger.Warnf("login RPC failed for %d, %v", status, err)
} }
...@@ -469,7 +468,7 @@ func processGroupMicChangeRsp(logger *log.Entry, uid uint64, pbData []byte) erro ...@@ -469,7 +468,7 @@ func processGroupMicChangeRsp(logger *log.Entry, uid uint64, pbData []byte) erro
msg := &userProxy.GroupMicChangeRsp{} msg := &userProxy.GroupMicChangeRsp{}
err := proto.Unmarshal(pbData, msg) err := proto.Unmarshal(pbData, msg)
if err == nil { if err == nil {
logger.Infof("groupMicChangeRsp,uid:%v,seqId:%v", uid, msg.SeqId) //logger.Infof("groupMicChangeRsp,uid:%v,seqId:%v", uid, msg.SeqId)
} else { } else {
return err return err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment