httplog

package
v0.4.0-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

ref: https://gist.github.com/Boerworz/b683e46ae0761056a636

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggingResponseWriter

func NewLoggingResponseWriter(w http.ResponseWriter) *loggingResponseWriter

func WrapHandlerWithLogging

func WrapHandlerWithLogging(wrappedHandler http.Handler) http.Handler

Types

type LoggableHTTPHeader

type LoggableHTTPHeader struct {
	http.Header

	ShouldLogCredentials bool
}

LoggableHTTPHeader makes an HTTP header loggable with zap.Object(). Headers with potentially sensitive information (Cookie, Set-Cookie, Authorization, and Proxy-Authorization) are logged with empty values.

func (LoggableHTTPHeader) MarshalLogObject

func (h LoggableHTTPHeader) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject satisfies the zapcore.ObjectMarshaler interface.

type LoggableHTTPRequest

type LoggableHTTPRequest struct {
	*http.Request
}

ref: caddyserver modules/caddyhttp/marshalers.go LoggableHTTPRequest makes an HTTP request loggable with zap.Object().

func (LoggableHTTPRequest) MarshalLogObject

func (r LoggableHTTPRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject satisfies the zapcore.ObjectMarshaler interface.

type LoggableHTTPRequestClient

type LoggableHTTPRequestClient struct {
	*http.Request
}

func (LoggableHTTPRequestClient) MarshalLogObject

func (r LoggableHTTPRequestClient) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject satisfies the zapcore.ObjectMarshaler interface.

type LoggableStringArray

type LoggableStringArray []string

LoggableStringArray makes a slice of strings marshalable for logging.

func (LoggableStringArray) MarshalLogArray

func (sa LoggableStringArray) MarshalLogArray(enc zapcore.ArrayEncoder) error

MarshalLogArray satisfies the zapcore.ArrayMarshaler interface.

type LoggableTLSConnState

type LoggableTLSConnState tls.ConnectionState

LoggableTLSConnState makes a TLS connection state loggable with zap.Object().

func (LoggableTLSConnState) MarshalLogObject

func (t LoggableTLSConnState) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject satisfies the zapcore.ObjectMarshaler interface.

type LoggingRoundTripper

type LoggingRoundTripper struct {
	Base http.RoundTripper
}

This type implements the http.RoundTripper interface

func (LoggingRoundTripper) RoundTrip

func (lrt LoggingRoundTripper) RoundTrip(r *http.Request) (res *http.Response, err error)

Jump to

Keyboard shortcuts

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