httplog

package module
v0.0.0-...-23b0cab Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: MIT Imports: 7 Imported by: 0

README

httplog

Client side utilities for logging HTTP requests and responses.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogFn

type LogFn func(context.Context, string, ...any)

LogFn is a function that logs a message with context and optional key-value pairs, e.g., slog.DebugContext.

type Logger

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

func NewLogger

func NewLogger(logFn LogFn) *Logger

func (*Logger) LogRequest

func (l *Logger) LogRequest(r *http.Request, body []byte)

func (*Logger) LogResponse

func (l *Logger) LogResponse(r *http.Response, body []byte)

type LoggingTransport

type LoggingTransport struct {
	Logger    *Logger
	Transport http.RoundTripper
}

func (*LoggingTransport) RoundTrip

func (t *LoggingTransport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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