refactor: 移除冗余日志输出并优化日志处理
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-02-02 18:32:41 +08:00
parent acc9bcf6ff
commit cdb7cec4ad
17 changed files with 59 additions and 100 deletions

View File

@@ -20,7 +20,6 @@ type ServerHandler struct{}
// 实现踢人
func (*ServerHandler) Kick(_ context.Context, userid uint32) error {
cool.Logger.Info(context.TODO(), "服务器收到踢人")
useid1, err := share.ShareManager.GetUserOnline(userid)
if err != nil {
@@ -39,7 +38,7 @@ func (*ServerHandler) Kick(_ context.Context, userid uint32) error {
// 注册logic服务器
func (*ServerHandler) RegisterLogic(ctx context.Context, id, port uint16) error {
cool.Logger.Debug(context.Background(), "注册logic服务器", id, port)
fmt.Println("注册logic服务器", id, port)
//TODO 待修复滚动更新可能导致的玩家可以同时在旧服务器和新服务器同时在线的bug
revClient, ok := jsonrpc.ExtractReverseClient[cool.ClientHandler](ctx)
@@ -59,19 +58,6 @@ func (*ServerHandler) RegisterLogic(ctx context.Context, id, port uint16) error
}
// func StartServer() {
// // create a new server instance
// rpcServer := jsonrpc.NewServer(jsonrpc.WithReverseClient[cool.ClientHandler](""))
// rpcServer.Register("", &ServerHandler{})
// cool.Logger.Debug(context.Background(), "jsonrpc server start", rpcport)
// // go time.AfterFunc(3000, func() {
// // testjsonrpc()
// // })
// err := http.ListenAndServe("0.0.0.0:"+rpcport, rpcServer)
// cool.Logger.Debug(context.Background(), "jsonrpc server fail", err)
// }
func CServer() *jsonrpc.RPCServer {
// create a new server instance
rpcServer := jsonrpc.NewServer(jsonrpc.WithReverseClient[cool.ClientHandler](""))
@@ -79,8 +65,7 @@ func CServer() *jsonrpc.RPCServer {
rpcServer.Register("", &ServerHandler{})
return rpcServer
// err := http.ListenAndServe("0.0.0.0:"+rpcport, rpcServer)
// // cool.Logger.Debug(context.Background(), "jsonrpc server fail", err)
}
var closer jsonrpc.ClientCloser