httplog

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

README

httplog

httplog provides an implementation of http.RoundTripper that logs every single request and response using a given logging function.

docs

Disclaimer

This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.

Documentation

Overview

Package httplog provides an implementation of http.RoundTripper that logs every single request and response using a given logging function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Transport

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

Transport satisfies http.RoundTripper

func NewTransport

func NewTransport(rt http.RoundTripper, logBody bool, logf func(string, ...interface{})) Transport

NewTransport returns a new Transport that uses the given RoundTripper, or http.DefaultTransport if nil, and logs all requests and responses using logf, or log.Printf if nil. The body of the requests and responses are logged too only if logBody is true.

func (Transport) Client

func (t Transport) Client() *http.Client

Client returns a new http.Client using the given transport.

func (Transport) RoundTrip

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

RoundTrip so Transport satifies http.RoundTripper

Jump to

Keyboard shortcuts

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