29 lines
421 B
Go
29 lines
421 B
Go
|
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 ",
|
||
|
},
|
||
|
})
|
||
|
}
|