caddy: Index | Files

package log

import ""

Package log implements request (access) logging middleware.


Package Files

log.go setup.go


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
const (
    // IP Masks that have no effect on IP Address
    DefaultIP4Mask = ""

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

type Entry Uses

type Entry struct {
    Format string
    Log    *httpserver.Logger

Entry represents a log entry under a path scope

type Logger Uses

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 Uses

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

type Rule Uses

type Rule struct {
    PathScope string
    Entries   []*Entry

Rule configures the logging middleware.

Package log imports 6 packages (graph) and is imported by 108 packages. Updated 2019-07-02. Refresh now. Tools for package owners.