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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
⌂ 换网址