whlog

package
v1.0.0-...-3f30213 Latest Latest
Warning

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

Go to latest
Published: May 30, 2017 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Overview

Package whlog provides functionality to log incoming requests and results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(addr string, handler http.Handler) error

ListenAndServe creates a TCP listener prior to calling Serve. It also logs the address it listens on, and wraps given handlers in whcompat.DoneNotify. Like the standard library, it sets TCP keepalive semantics on.

func LogRequests

func LogRequests(logger Loggerf, h http.Handler) http.Handler

LogRequests takes a Handler and makes it log requests (prior to request handling). whlog.Default makes a good default logger.

func LogResponses

func LogResponses(logger Loggerf, h http.Handler) http.Handler

LogResponses takes a Handler and makes it log responses. LogResponses uses whmon's ResponseWriter to keep track of activity. whfatal.Catch should be placed *inside* if applicable. whlog.Default makes a good default logger.

Types

type Loggerf

type Loggerf func(format string, arg ...interface{})
var (
	Default Loggerf = log.Printf
)

Jump to

Keyboard shortcuts

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