logger

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LogPattern is format for writing the logRecord
	LogPattern = "%s - - [%s] \"%s\" %d %d %s \"%s\" \"%s\"\n"
	// DateTimeFormat is for logging Date and Time of request
	DateTimeFormat = "02/Jan/2006 15:04:05" // Minimal

)

Variables

This section is empty.

Functions

func NewLoggingHandler

func NewLoggingHandler(handler http.Handler, out io.Writer) http.Handler

NewLoggingHandler for creating a new Logging Handler

Types

type LogRecord

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

LogRecord struct extends http.ResponseWriter interface which has different methods included in it.

func (*LogRecord) Log

func (l *LogRecord) Log(out io.Writer)

Log method to be called for logging to "out"

func (*LogRecord) Write

func (l *LogRecord) Write(p []byte) (int, error)

Write method has been extended to record the bytes written or the content length

func (*LogRecord) WriteHeader

func (l *LogRecord) WriteHeader(statusCode int)

WriteHeader method has been extended to record status code from previous handler.

type LoggingHandler

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

LoggingHandler is to be used as wrapper of mux.

func (LoggingHandler) ServeHTTP

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

Jump to

Keyboard shortcuts

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