logging

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	RequestHeaders:  []string{"User-Agent", "Accept", "Referer"},
	ResponseHeaders: []string{"Cache-Control", "Content-Encoding", "Content-Type", "Location"},
}

Functions

func NewBytesCountReader added in v1.9.0

func NewBytesCountReader(beresp *http.Response) io.ReadCloser

NewBytesCountReader just counts the raw read bytes from given response body for logging purposes.

func RoundMS added in v1.12.0

func RoundMS(d time.Duration) float64

func UpdateCustomAccessLogContext added in v1.7.0

func UpdateCustomAccessLogContext(req *http.Request, body hcl.Body)

Types

type AccessLog

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

func NewAccessLog

func NewAccessLog(c *Config, logger logrus.FieldLogger) *AccessLog

func (*AccessLog) Do added in v1.7.0

func (log *AccessLog) Do(writer http.ResponseWriter, req *http.Request)

type BytesCountReader added in v1.9.0

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

func (*BytesCountReader) Close added in v1.9.0

func (b *BytesCountReader) Close() error

func (*BytesCountReader) Read added in v1.9.0

func (b *BytesCountReader) Read(p []byte) (n int, err error)

type Config

type Config struct {
	NoProxyFromEnv  bool
	ParentFieldKey  string   `env:"log_parent_field"`
	RequestHeaders  []string `env:"log_request_headers"`
	ResponseHeaders []string `env:"log_response_headers"`
	TypeFieldKey    string   `env:"log_type_value"`
}

type Fields

type Fields map[string]interface{}

type Level added in v1.9.0

type Level interface {
	Level(level logrus.Level)
}

type RecorderInfo

type RecorderInfo interface {
	StatusCode() int
	WrittenBytes() int
}

type RoundtripHandlerFunc

type RoundtripHandlerFunc http.HandlerFunc

func (RoundtripHandlerFunc) ServeHTTP

func (f RoundtripHandlerFunc) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type Stack added in v1.9.0

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

func FromContext added in v1.9.0

func FromContext(ctx context.Context) (*Stack, bool)

func NewStack added in v1.9.0

func NewStack(ctx context.Context) (context.Context, *Stack)

func (*Stack) Fire added in v1.9.0

func (s *Stack) Fire()

func (*Stack) Push added in v1.9.0

func (s *Stack) Push(e *logrus.Entry) Level

type UpstreamLog

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

func NewUpstreamLog

func NewUpstreamLog(log *logrus.Entry, next http.RoundTripper, ignoreProxyEnv bool) *UpstreamLog

func (*UpstreamLog) LogEntry

func (u *UpstreamLog) LogEntry() *logrus.Entry

func (*UpstreamLog) RoundTrip

func (u *UpstreamLog) RoundTrip(req *http.Request) (*http.Response, error)

func (*UpstreamLog) Value added in v1.9.0

func (u *UpstreamLog) Value() cty.Value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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