Documentation ¶
Index ¶
- Constants
- func Dumper(w io.Writer) func(http.Handler) http.Handler
- func GetReqID(ctx context.Context) string
- func NewLogger() func(next http.Handler) http.Handler
- func RequestID(options ...RequestIDOption) func(http.Handler) http.Handler
- type LogEntry
- type Logger
- 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.
Types ¶
type LogEntry ¶
type LogEntry struct { *Logger // contains filtered or unexported fields }
LogEntry represents an individual log entry.
type Logger ¶
type Logger struct {
Logger middleware.LoggerInterface
}
Logger is a middleware that logs useful data about each HTTP request.
func (*Logger) NewLogEntry ¶
func (l *Logger) NewLogEntry(r *http.Request) middleware.LogEntry
NewLogEntry creates a new LogEntry for the request.
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.