logging

package
v0.0.0-...-0c438d6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultRequestIDHeader is the default header name for request ID
	DefaultRequestIDHeader = "X-Request-ID"
)

Variables

This section is empty.

Functions

func NewCallWrapper

func NewCallWrapper(opts ...Option) client.CallWrapper

NewCallWrapper creates a new call wrapper for request logging

func NewClientWrapper

func NewClientWrapper(opts ...Option) client.Wrapper

NewClientWrapper creates a new client wrapper for request logging

func NewHandlerWrapper

func NewHandlerWrapper(opts ...Option) server.HandlerWrapper

NewHandlerWrapper creates a new handler wrapper for request logging

Types

type Config

type Config struct {
	IncludeRequestID *bool  `yaml:"include_request_id,omitempty"`
	LogLevel         string `yaml:"log_level,omitempty"`
}

Config for the logging middleware configuration

type Option

type Option func(*Options)

Option function for setting options

func WithConfig

func WithConfig(cfg *Config) Option

WithConfig applies configuration to the logging options

func WithIncludeRequestID

func WithIncludeRequestID(include bool) Option

WithIncludeRequestID sets whether to include request ID in logs

func WithLogLevel

func WithLogLevel(level string) Option

WithLogLevel sets the log level for requests

type Options

type Options struct {
	IncludeRequestID bool
	LogLevel         string
}

Options for the logging middleware

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns default options

Source Files

  • options.go
  • wrappers.go

Jump to

Keyboard shortcuts

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