1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-02 11:00:37 +08:00
parent aa58dfdbb2
commit ff675f9430
6 changed files with 16 additions and 12 deletions

View File

@@ -12,7 +12,7 @@ import (
"blazing/cool"
"blazing/logic/service/player"
"github.com/gogf/gf/v2/os/glog"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"github.com/panjf2000/gnet/v2"
)
@@ -78,7 +78,7 @@ func (s *Server) OnClose(c gnet.Conn, err error) (action gnet.Action) {
return
}
func (s *Server) OnTick() (delay time.Duration, action gnet.Action) {
glog.Info(context.Background(), gtime.Now().ISO8601(), cool.Config.ServerInfo.OnlineID, "链接数", atomic.LoadInt64(&s.connected))
g.Log().Async().Info(context.Background(), gtime.Now().ISO8601(), cool.Config.ServerInfo.OnlineID, "链接数", atomic.LoadInt64(&s.connected))
if s.quit && atomic.LoadInt64(&s.connected) == 0 {
//执行正常退出逻辑
os.Exit(0)

View File

@@ -80,7 +80,12 @@ func Init(isGame bool) {
}
// 注册命令处理函数
glog.Debug(context.Background(), "注册方法", cmd, method.Name)
if cool.Config.ServerInfo.IsDebug != 0 {
fmt.Println("注册方法", cmd, method.Name)
}
cmdInfo := cool.Cmd{
Func: methodValue,
Req: methodValue.Type().In(0).Elem(),

View File

@@ -22,6 +22,8 @@ import (
"github.com/gogf/gf/v2/util/gconv"
)
var fightpanlog *glog.Logger
type MyWriter struct {
logger *glog.Logger
user uint32
@@ -37,18 +39,17 @@ func (w *MyWriter) Write(p []byte) (n int, err error) {
return w.logger.Write(p)
}
func init() {
//var ctx = context.Background()
glog.SetWriter(&MyWriter{
fightpanlog.SetWriter(&MyWriter{
logger: glog.New(),
})
}
func (f *FightC) battleLoop() {
defer func() {
if err := recover(); err != nil { // 恢复 panicerr 为 panic 错误值
// 1. 打印错误信息
var ctx = context.Background()
cool.Logger.Error(context.TODO(), "panic 错误:", err)
glog.Errorf(ctx, "%+v", err)
fightpanlog.Errorf(ctx, "%+v", err)
f.Broadcast(func(ff *input.Input) {
if p, ok := ff.Player.(*player.Player); ok {
head := common.NewTomeeHeader(1001, p.Info.UserID)

View File

@@ -61,7 +61,7 @@ func (h *ClientData) Recv(data common.TomeeHeader) {
cmdlister, ok := cool.CmdCache[data.CMD]
if !ok {
glog.Debug(context.Background(), data.UserID, data.CMD, "cmd未注册")
// glog.Debug(context.Background(), data.UserID, data.CMD, "cmd未注册")
return //TODO 待实现cmd未注册
}

View File

@@ -8,8 +8,6 @@ import (
"blazing/modules/player/model"
"context"
"encoding/hex"
"github.com/gogf/gf/v2/os/glog"
)
// LoginSidInfo 登录携带的凭证结构体
@@ -33,7 +31,7 @@ func (l *MAIN_LOGIN_IN) CheakSession() bool {
}
cool.CacheManager.Remove(context.Background(), fmt.Sprintf("session: %d", l.Head.UserID))
glog.Debug(context.Background(), "后端获取", t1, err)
//glog.Debug(context.Background(), "后端获取", t1, err)
return true
}

View File

@@ -465,7 +465,7 @@ func (s *ServerHandler) OnMessage(socket *gws.Conn, gwsmessage *gws.Message) {
}
func (s *ServerHandler) OnClose(socket *gws.Conn, err error) {
glog.Debug(context.Background(), "连接断开:", err)
//glog.Debug(context.Background(), "连接断开:", err)
if s.session != nil {
s.session.closed.Store(true)
if s.session.SSHSession != nil {