Documentation ¶
Index ¶
- Constants
- func Dumper(w io.Writer) func(http.Handler) http.Handler
- func GetReqID(ctx context.Context) string
- func NewLogFormatter(logger *slog.Logger) middleware.LogFormatter
- func RequestID(options ...RequestIDOption) func(http.Handler) http.Handler
- type LogEntry
- type LogFormatter
- type RequestIDOption
- type RequestIDOptions
Constants ¶
View Source
const RequestIDKey ctxKeyRequestID = 0
RequestIDKey is the key that holds the unique request ID in a request context.
Variables ¶
This section is empty.
Functions ¶
func Dumper ¶
Dumper returns a debug middleware which prints detailed information about incoming requests and outgoing responses including all headers, parameters and bodies.
func GetReqID ¶
GetReqID returns a request ID from the given context if one is present. Returns the empty string if a request ID cannot be found.
func NewLogFormatter ¶
func NewLogFormatter(logger *slog.Logger) middleware.LogFormatter
Types ¶
type LogEntry ¶
type LogEntry struct {
// contains filtered or unexported fields
}
LogEntry represents an individual log entry.
type LogFormatter ¶
type LogFormatter func(r *http.Request) middleware.LogEntry
func (LogFormatter) NewLogEntry ¶
func (l LogFormatter) NewLogEntry(r *http.Request) middleware.LogEntry
type RequestIDOption ¶
type RequestIDOption func(*RequestIDOptions) *RequestIDOptions
func UseXRequestIDHeaderOption ¶
func UseXRequestIDHeaderOption(f bool) RequestIDOption
func XRequestIDLimitOption ¶
func XRequestIDLimitOption(limit int) RequestIDOption
type RequestIDOptions ¶
type RequestIDOptions struct {
// contains filtered or unexported fields
}
func (*RequestIDOptions) UseRequestID ¶
func (o *RequestIDOptions) UseRequestID() bool
Click to show internal directories.
Click to hide internal directories.