Skip to content

Repository files navigation

Go HTTP Handler Access Log

godoclicenseBuild StatusCoverage

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"))
})))
iferr:=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

Stars

20 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages