httplog

package
v0.0.0-...-f64633d Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StdlogLogger stdlogLogger

Functions

func Handler

func Handler(logger Logger, h http.Handler) http.Handler

func Transport

func Transport(logger Logger, t http.RoundTripper) http.RoundTripper

Types

type ClientRecvResponse

type ClientRecvResponse struct {
	Id            int64       `json:"id"`
	Method        string      `json:"method,omitempty"`
	URL           string      `json:"url,omitempty"`
	Error         string      `json:"error,omitempty"`
	StatusCode    int         `json:"statusCode,omitempty"`
	Header        http.Header `json:"header,omitempty"`
	Body          string      `json:"body,omitempty"`
	Body64        []byte      `json:"body64,omitempty"`
	BodyTruncated bool        `json:"bodyTruncated,omitempty"`
	Hijacked      bool        `json:"hijacked,omitempty"`
}

func (ClientRecvResponse) Kind

func (e ClientRecvResponse) Kind() EventKind

type ClientSendRequest

type ClientSendRequest struct {
	Id            int64       `json:"id"`
	Method        string      `json:"method"`
	URL           string      `json:"url"`
	Header        http.Header `json:"header"`
	Body          string      `json:"body,omitempty"`
	Body64        []byte      `json:"body64,omitempty"`
	BodyTruncated bool        `json:"bodyTruncated,omitempty"`
	BodyFlushed   bool        `json:"bodyFlushed,omitempty"`
	Hijacked      bool        `json:"hijacked,omitempty"`
}

func (ClientSendRequest) Kind

func (e ClientSendRequest) Kind() EventKind

type Event

type Event interface {
	Kind() EventKind
}

type EventKind

type EventKind string
const (
	KindClientSendRequest  EventKind = "client ->"
	KindClientRecvResponse EventKind = "client <-"
	KindServerRecvRequest  EventKind = "server <-"
	KindServerSendResponse EventKind = "server ->"
)

type Logger

type Logger interface {
	Log(event Event)
}

type ServerRecvRequest

type ServerRecvRequest ClientSendRequest

func (ServerRecvRequest) Kind

func (e ServerRecvRequest) Kind() EventKind

type ServerSendResponse

type ServerSendResponse ClientRecvResponse

func (ServerSendResponse) Kind

func (e ServerSendResponse) Kind() EventKind

Jump to

Keyboard shortcuts

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