Documentation ¶
Overview ¶
Package apilogging aids debugging of API interactions by providing a reusable logging mechanism.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewInterceptingRoundTripper ¶
func NewInterceptingRoundTripper(cfg *LoggerConfig, wrapped http.RoundTripper) (http.RoundTripper, error)
NewInterceptingRoundTripper sets up a logging http.RoundTripper.
func NewLoggingHTTPClient ¶
NewLoggingHTTPClient provides an instrumented HTTP client, which can be used for constructing an appropriate service-specific API client.
Types ¶
type LoggerConfig ¶
type LoggerConfig struct { // Scopes allows for the override of API scopes used by the underlying HTTP // api transport. If not specified, uses the default cloud-platform scope. Scopes []string // Logging must contain an instance of a logger. Logger *log.Logger // CaptureFullRequest governs whether the body of the request is captured. CaptureFullRequest bool // CaptureFullResponse governs whether the body of the response is captured. CaptureFullResponse bool // LogRequest allows filtration based on the request body bytes. LogRequest func(b []byte) bool // LogResponse allows filtration based on the response body bytes. Whether the // request was matched is also available. LogResponse func(b []byte, requestMatched bool) bool }
LoggerConfig governs the behavior of the api logging.
Click to show internal directories.
Click to hide internal directories.