log

package
Version: v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package log implements request (access) logging middleware.

Index

Constants

View Source
const (
	// DefaultLogFilename is the default log filename.
	DefaultLogFilename = "access.log"
	// CommonLogFormat is the common log format.
	CommonLogFormat = `{remote} ` + CommonLogEmptyValue + ` [{when}] "{method} {uri} {proto}" {status} {size}`
	// CommonLogEmptyValue is the common empty log value.
	CommonLogEmptyValue = "-"
	// CombinedLogFormat is the combined log format.
	CombinedLogFormat = CommonLogFormat + ` "{>Referer}" "{>User-Agent}"`
	// DefaultLogFormat is the default log format.
	DefaultLogFormat = CommonLogFormat
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	Next      httpserver.Handler
	Rules     []Rule
	ErrorFunc func(http.ResponseWriter, *http.Request, int) // failover error handler
}

Logger is a basic request logging middleware.

func (Logger) ServeHTTP

func (l Logger) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)

type Rule

type Rule struct {
	PathScope  string
	OutputFile string
	Format     string
	Log        *log.Logger
	Roller     *httpserver.LogRoller
	// contains filtered or unexported fields
}

Rule configures the logging middleware.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL