+
Skip to content

rs/xaccess

Repository files navigation

Go HTTP Handler Access Log

godoc license Build Status Coverage

Package xaccess is a middleware that logs all access requests performed on the sub handler using xlog and xstats stored in context if any.

Usage

c := xhandler.Chain{}

c.UseC(xlog.NewHandler(xlog.Config{}))
c.UseC(xstats.NewHandler(dogstatsd.New(statsdWriter, flushInterval), tags))

c.UseC(xaccess.NewHandler())

http.Handle("/", c.Handler(xhandler.HandlerFuncC(func(ctx context.Context, w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("Hello World"))
})))

if err := http.ListenAndServe(":8080", nil); err != nil {
    log.Fatal(err)
}

Licenses

All source code is licensed under the MIT License.

About

Go http handler access logger

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载