Go API Documentation

github.com/caddyserver/caddy/v2/modules/caddyhttp/logging

No package summary is available.

Package

Files: 2. Third party imports: 1. Imports from organisation: 0. Tests: 0. Benchmarks: 0.

Vars

Interface guards

Types

LogAppend

LogAppend implements a middleware that takes a key and value, where the key is the name of a log field and the value is a placeholder, or variable key, or constant value to use for that field.

Field name Field type Comment
Key

string

Key is the name of the log field.

Value

string

Value is the value to use for the log field. If it is a placeholder (with surrounding {}), it will be evaluated when the log is written. If the value is a key that exists in the vars map, the value of that key will be used. Otherwise the value will be used as-is as a constant string.

Functions

func (*LogAppend) UnmarshalCaddyfile

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

func (LogAppend) CaddyModule

CaddyModule returns the Caddy module information.

func (LogAppend) ServeHTTP

Uses: caddyhttp.ExtraLogFields, caddyhttp.ExtraLogFieldsCtxKey, caddyhttp.VarsCtxKey, strings.Count, strings.HasPrefix, strings.HasSuffix, strings.Trim, zap.Any.

Private functions

func init

References: httpcaddyfile.RegisterHandlerDirective.

func parseCaddyfile

parseCaddyfile sets up the log_append handler from Caddyfile tokens. Syntax:

log_append [<matcher>] <key> <value>