log

package
v2.0.0-rc6 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package log defines a middleware to handle response writing errors as well as log each request and its response if enabled.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	// Log logs the request and/or response.
	Log(remoteAddr net.Addr, request, response *dns.Msg)
	// Error logs errors returned by the DNS handler.
	Error(id uint16, errorString string)
}

type Middleware

type Middleware struct {
	// contains filtered or unexported fields
}

func New

func New(settings Settings) (middleware *Middleware, err error)

func (*Middleware) Stop

func (m *Middleware) Stop() (err error)

func (*Middleware) String

func (m *Middleware) String() string

func (*Middleware) Wrap

func (m *Middleware) Wrap(next dns.Handler) dns.Handler

Wrap wraps the DNS handler with the middleware.

type Settings

type Settings struct {
	// Logger is the logger to use.
	// It defaults to a No-op implementation.
	Logger Logger
}

func (*Settings) SetDefaults

func (s *Settings) SetDefaults()

func (*Settings) String

func (s *Settings) String() string

func (*Settings) ToLinesNode

func (s *Settings) ToLinesNode() (node *gotree.Node)

func (*Settings) Validate

func (s *Settings) Validate() (err error)

Directories

Path Synopsis
logger

Jump to

Keyboard shortcuts

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