log

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: Apache-2.0 Imports: 6 Imported by: 5 modules, 4 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.

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 + ` {user} [{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
)
View Source
const (
	// IP Masks that have no effect on IP Address
	DefaultIP4Mask = "255.255.255.255"

	DefaultIP6Mask = "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry added in v0.9.2

type Entry struct {
	Format string
	Log    *httpserver.Logger
}

Entry represents a log entry under a path scope

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
	Entries   []*Entry
}

Rule configures the logging middleware.

Jump to

Keyboard shortcuts

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