完成日志输出到文件、终端多处的处理

This commit is contained in:
2024-11-13 16:11:59 +08:00
parent 9b643f4352
commit 28291598bb
28 changed files with 175 additions and 330 deletions

View File

@@ -4,7 +4,7 @@ import (
"encoding/json"
"game-driver/internal/schema"
"game-driver/leaf"
"game-driver/pkg/logger"
"go.uber.org/zap"
)
type JSONKey string
@@ -17,7 +17,7 @@ func PayloadJSON[T schema.JsonModel]() leaf.HandlerFunc {
pm := new(T)
err := json.Unmarshal(c.Payload, pm)
if err != nil {
logger.Panicln("报文解析错误", err)
zap.S().Panicln("报文解析错误", err)
}
leaf.WithValue[*T](c, PayloadJSONKey, pm)
c.Next()