logging

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 24 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

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

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

func RoundMS

func RoundMS(d time.Duration) float64

func UpdateCustomAccessLogContext

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

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

type BytesCountReader

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

func (*BytesCountReader) Close

func (b *BytesCountReader) Close() error

func (*BytesCountReader) Read

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

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

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

func FromContext

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

func NewStack

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

func (*Stack) Fire

func (s *Stack) Fire()

func (*Stack) Push

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

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