增加日志

This commit is contained in:
hahwu 2026-01-26 11:46:40 +08:00
parent e9d1565115
commit ecf37639a5
3 changed files with 21 additions and 8 deletions

View File

@ -156,7 +156,7 @@ func (w *fileLogWriter) doRotate() error {
// return error if the last file checked still existed // return error if the last file checked still existed
if err == nil { if err == nil {
return fmt.Errorf("rotate: cannot find free log number to rename %s", w.Filename) //return fmt.Errorf("rotate: cannot find free log number to rename %s", w.Filename)
} }
w.fileWriter.Close() w.fileWriter.Close()

View File

@ -926,12 +926,24 @@ func Destroy() {
log.Debug("palyer %d 断开连接 写入数据", k) log.Debug("palyer %d 断开连接 写入数据", k)
return true return true
}) })
G_GameLogicPtr.FriendMgr.SaveData() if G_GameLogicPtr.FriendMgr != nil {
G_GameLogicPtr.RankMgr.SaveData() G_GameLogicPtr.FriendMgr.SaveData()
G_GameLogicPtr.ChampshipMgr.SaveData() }
G_GameLogicPtr.MailMgr.SaveData() if G_GameLogicPtr.MessageMgr != nil {
G_GameLogicPtr.VarMgr.SaveData() G_GameLogicPtr.MessageMgr.SaveData()
G_GameLogicPtr.MLogManager.Close() }
if G_GameLogicPtr.VarMgr != nil {
G_GameLogicPtr.VarMgr.SaveData()
}
if G_GameLogicPtr.ChampshipMgr != nil {
G_GameLogicPtr.ChampshipMgr.SaveData()
}
if G_GameLogicPtr.MailMgr != nil {
G_GameLogicPtr.MailMgr.SaveData()
}
if G_GameLogicPtr.RankMgr != nil {
G_GameLogicPtr.RankMgr.SaveData()
}
} }
log.Debug("服务器下线完成") log.Debug("服务器下线完成")
} }

View File

@ -60,7 +60,7 @@ func HandleClientReq(args []interface{}) {
// 消息的发送者 // 消息的发送者
a := args[1].(gate.Agent) a := args[1].(gate.Agent)
buf := m.GetInfo() buf := m.GetInfo()
// log.Debug("消息Func : %s", m.GetFunc()) log.Debug("消息Func : %s", m.GetFunc())
switch m.GetFunc() { switch m.GetFunc() {
case "ClientTick": case "ClientTick":
case "ReqChangePassword": case "ReqChangePassword":
@ -119,6 +119,7 @@ func HandleClientReq(args []interface{}) {
G_GameLogicPtr.SendServerVersion(a) G_GameLogicPtr.SendServerVersion(a)
case "ReqRegisterAccount": case "ReqRegisterAccount":
detail := &msg.ReqRegisterAccount{} detail := &msg.ReqRegisterAccount{}
log.Debug("player %s start login", detail.UserName)
proto.Unmarshal(buf, detail) proto.Unmarshal(buf, detail)
gl := G_getGameLogic() gl := G_getGameLogic()
defer func() { defer func() {