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

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

@@ -2,13 +2,13 @@ package middleware
import (
"game-driver/leaf"
"game-driver/pkg/logger"
"go.uber.org/zap"
)
func RunLog() leaf.HandlerFunc {
return func(c *leaf.Context) {
logger.Infof("收到消息, topic: %s, payload: %s", c.Topic, c.Payload)
defer logger.Infof("处理结束")
zap.S().Infof("收到消息, topic: %s, payload: %s", c.Topic, c.Payload)
defer zap.S().Infof("处理结束")
c.Next()
}