logging

package
v0.0.0-...-9b598c7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Threshold 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)
	FormatObject(o interface{}) (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