logging

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const LoggingThreshold int32 = 1

Variables

This section is empty.

Functions

func NewJSONLogFormatter

func NewJSONLogFormatter() *jsonLogFormatter

func NewLoggingWriter

func NewLoggingWriter(w http.ResponseWriter, r *http.Request, f LogFormatter) *loggingWriter

func RequestLoggingMiddleware

func RequestLoggingMiddleware(handler http.Handler) http.Handler

Types

type LogFormatter

type LogFormatter interface {
	FormatRequestLog(request *http.Request) (string, error)
	FormatResponseLog(responseInfo *ResponseInfo) (string, error)
}

type ResponseInfo

type ResponseInfo struct {
	Header  http.Header `json:"response_header,omitempty"`
	Body    []byte      `json:"response_body,omitempty"`
	Status  int         `json:"response_status,omitempty"`
	Elapsed string      `json:"elapsed,omitempty"`
}

Jump to

Keyboard shortcuts

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