镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
rsPublic

About

Go http handler access logger

Resources

Stars

20 stars

Watchers

1 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

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

Stars

20 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages