requestlogger

package
v0.0.0-...-959fa67 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupExpressionAttributes

func CleanupExpressionAttributes(attributes []config.CustomAttribute) []config.CustomAttribute

func New

func New(logger *zap.Logger, opts ...Option) func(h http.Handler) http.Handler

Types

type ContextFunc

type ContextFunc func(
	logger *zap.Logger,
	fields []config.CustomAttribute,
	exprFields []ExpressionAttribute,
	err any,
	r *http.Request,
	rh *http.Header,
	overrideExprCtx *expr.Context,
) []zapcore.Field

type ExpressionAttribute

type ExpressionAttribute struct {
	Key     string
	Default string
	Expr    *vm.Program
}

func GetAccessLogConfigExpressions

func GetAccessLogConfigExpressions(attributes []config.CustomAttribute, exprManager *exprlocal.Manager) ([]ExpressionAttribute, error)

type IPAnonymizationConfig

type IPAnonymizationConfig struct {
	Enabled bool
	Method  IPAnonymizationMethod
}

Option provides a functional approach to define configuration for a handler; such as setting the logging whether to print stack traces on panic.

type IPAnonymizationMethod

type IPAnonymizationMethod string
const (
	Hash   IPAnonymizationMethod = "hash"
	Redact IPAnonymizationMethod = "redact"
)

type Option

type Option func(handler *handler)

Option provides a functional approach to define configuration for a handler; such as setting the logging whether to print stack traces on panic.

func WithAnonymization

func WithAnonymization(ipConfig *IPAnonymizationConfig) Option

func WithAttributes

func WithAttributes(attributes []config.CustomAttribute) Option

func WithDefaultOptions

func WithDefaultOptions() Option

func WithExprAttributes

func WithExprAttributes(attributes []ExpressionAttribute) Option

func WithFields

func WithFields(fields ...zapcore.Field) Option

func WithFieldsHandler

func WithFieldsHandler(fn ContextFunc) Option

func WithIgnoreQueryParamsList

func WithIgnoreQueryParamsList(ignoreList []string) Option

func WithLogLevelHandler

func WithLogLevelHandler(fn func(r *http.Request) zapcore.Level) Option

func WithNoTimeField

func WithNoTimeField() Option

type SubgraphAccessLogger

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

func NewSubgraphAccessLogger

func NewSubgraphAccessLogger(logger *zap.Logger, opts SubgraphOptions) *SubgraphAccessLogger

func (*SubgraphAccessLogger) Error

func (h *SubgraphAccessLogger) Error(message string, fields []zap.Field)

func (*SubgraphAccessLogger) Info

func (h *SubgraphAccessLogger) Info(message string, fields []zap.Field)

func (*SubgraphAccessLogger) RequestFields

func (h *SubgraphAccessLogger) RequestFields(respInfo *resolve.ResponseInfo, overrideExprCtx *expr.Context) []zap.Field

type SubgraphOptions

type SubgraphOptions struct {
	IPAnonymizationConfig *IPAnonymizationConfig
	FieldsHandler         ContextFunc
	Fields                []zapcore.Field
	Attributes            []config.CustomAttribute
	ExprAttributes        []ExpressionAttribute
}

Jump to

Keyboard shortcuts

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