xaccess

package module
v0.0.0-...-f630362 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2016 License: MIT Imports: 7 Imported by: 76

README

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.

Documentation

Overview

Package xaccess is a middleware that logs all access requests performed on the sub handler using github.com/rs/xlog and github.com/rs/xstats stored in context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler() func(next http.Handler) http.Handler

NewHandler returns a handler that log access information about each request performed on the provided sub-handlers. Uses context's github.com/rs/xlog and github.com/rs/xstats if present for logging.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL