weather/web/middleware/log.go

29 lines
421 B
Go
Raw Normal View History

2025-01-02 22:57:51 +08:00
package middleware
import (
"cc/util/log"
"github.com/gofiber/contrib/fiberzap/v2"
"github.com/gofiber/fiber/v2"
)
func Log() func(*fiber.Ctx) error {
return fiberzap.New(fiberzap.Config{
Logger: log.W.Desugar(),
Fields: []string{
"status",
"method",
"path",
"protocol",
"ip",
"latency",
"ua",
},
Messages: []string{
"Server error",
"Client error",
"Success ",
},
})
}