instrumentedwriter

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: Apache-2.0 Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggingHandler

func NewLoggingHandler(handler http.Handler, logger Logger) http.Handler

Types

type LogRecord

type LogRecord struct {
	Time                                      time.Time
	Ip, Method, Uri, Protocol, Username, Host string
	UserAgent                                 string
	Status                                    int
	Size                                      int64
	ElapsedTime                               time.Duration
	RequestHeader                             http.Header
	CustomRecords                             map[string]string
}

type Logger

type Logger interface {
	Log(record LogRecord)
}

type LoggingHandler

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

func (*LoggingHandler) ServeHTTP

func (h *LoggingHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type LoggingWriter

type LoggingWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func (*LoggingWriter) CloseNotify

func (r *LoggingWriter) CloseNotify() <-chan bool

http.CloseNotifier interface

func (*LoggingWriter) Flush

func (r *LoggingWriter) Flush()

http.Flusher

func (*LoggingWriter) Hijack

func (r *LoggingWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)

func (*LoggingWriter) Push

func (r *LoggingWriter) Push(target string, opts *http.PushOptions) error

http.Pusher

func (*LoggingWriter) SetCustomLogRecord

func (r *LoggingWriter) SetCustomLogRecord(key, value string)

w.(accesslogger.LoggingWriter).SetCustomLogRecord("X-User-Id", "3")

func (*LoggingWriter) SetUsername

func (r *LoggingWriter) SetUsername(username string)

w.(accesslogger.LoggingWriter).SetUsername("alice")

func (*LoggingWriter) Write

func (r *LoggingWriter) Write(p []byte) (int, error)

func (*LoggingWriter) WriteHeader

func (r *LoggingWriter) WriteHeader(status int)

Jump to

Keyboard shortcuts

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