Documentation ¶
Index ¶
- Variables
- func DefaultLogging(log *zap.Logger) func(http.Handler) http.Handler
- func DefaultRequestId() func(next http.Handler) http.Handler
- func DefaultSentry() func(http.Handler) http.Handler
- func DefautSentryPanicHandler() func(*http.Request, interface{})
- func GetLogger(ctx context.Context) *zap.Logger
- func GetRequestId(ctx context.Context) string
- func Logging(log *zap.Logger, funcs ...FieldExtractor) func(http.Handler) http.Handler
- func RequestId(header string, f RequestIdMaker) func(http.Handler) http.Handler
- func Sentry(header string, f func(*http.Request, interface{})) func(http.Handler) http.Handler
- func Timeout(d time.Duration) func(http.Handler) http.Handler
- func WithLogger(ctx context.Context, log *zap.Logger) context.Context
- type FieldExtractor
- type RequestIdMaker
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultLogger *zap.Logger = zap.L()
)
Functions ¶
func DefaultRequestId ¶
DefaultRequestId creates default RequestId middleware.
func GetRequestId ¶
GetRequestId returns request identifier from supplied context, or an empty string when none is present.
func RequestId ¶
RequestId is a middleware that injects request identifier to the context and adds it to the response. When there is no header present containing request identifier, f is used to generate one.
Types ¶
type FieldExtractor ¶
func WithHttpMethod ¶
func WithHttpMethod(name string) FieldExtractor
func WithHttpPath ¶
func WithHttpPath(name string) FieldExtractor
func WithHttpRemoteAddr ¶
func WithHttpRemoteAddr(name string) FieldExtractor
func WithHttpRequestId ¶
func WithHttpRequestId(name string) FieldExtractor
type RequestIdMaker ¶
type RequestIdMaker func() string
Click to show internal directories.
Click to hide internal directories.