优化日志

This commit is contained in:
hahwu 2026-04-03 15:06:02 +08:00
commit d1896c1695

View File

@ -16,6 +16,7 @@ import (
"gitea.bywaystudios.com/pet_home/leaf/log"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"server/db"
@ -250,15 +251,16 @@ func HandleClientReq(args []interface{}) {
p.(*Player).Recover(backup) //还原Player的数据
return
}
var logDetailMsg *proto.Message
str := ""
if conf.Server.GameName == "pet_home" || conf.Server.GameName == "merge_pet_sdk" {
logDetailMsg = &detailMsg
strbuf, _ := protojson.Marshal(detailMsg)
str = string(strbuf)
}
p.(*Player).ProcessTrigger()
p.(*Player).TeLog("func_exec_time", map[string]interface{}{
"method_name": m.GetFunc(),
"exec_time": fmt.Sprintf("%v", time.Since(start)),
"proto": logDetailMsg,
"proto": str,
})
}
}