Documentation ¶
Overview ¶
Package ginlog is gin server logger middleware.
Example ¶
package main import ( "github.com/boxgo/box/pkg/logger" "github.com/boxgo/box/pkg/server/ginserver" "github.com/boxgo/box/pkg/server/ginserver/mid/ginlog" "github.com/gin-gonic/gin" ) func main() { ginserver.Use(ginlog.Logger()) ginserver.GET("/ping", func(ctx *gin.Context) { ctx.Data(200, "text/plain", []byte("pong")) }) if err := ginserver.Run(); err != nil { logger.Fatal(err) } }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Default = StdConfig("default").Build()
)
Functions ¶
Types ¶
type Config ¶
type Config struct { Skips []string `config:"skips" desc:"skip urls"` UserAgent bool `config:"useragent" desc:"log user-agent"` RequestIP bool `config:"requestIp" desc:"log request ip"` RequestHeader bool `config:"requestHeader" desc:"log request header"` RequestQuery bool `config:"requestQuery" desc:"log request query"` RequestBody bool `config:"requestBody" desc:"log request body"` ResponseBody bool `config:"responseBody" desc:"log response body"` // contains filtered or unexported fields }
Config 配置
Click to show internal directories.
Click to hide internal directories.