Documentation ¶
Index ¶
- Variables
- func Append(m1 []Middleware, m2 ...Middleware) http.Handler
- func AppendHandler(m []Middleware, h http.Handler) http.Handler
- func GetRequestId(ctx context.Context) string
- func RequestId(next http.Handler) http.Handler
- type LogReq
- type LoggerOption
- type Middleware
- func JsonRequestResponder[T1 any, T2 any](log logger.Logger, h func(req *T1) (T2, error)) Middleware
- func JsonResponder[T any](log logger.Logger, h func() (T, error)) Middleware
- func PrometheusMetrics(begin *prometheus.CounterVec, finished *prometheus.HistogramVec) Middleware
- func RequestLogger(log logger.Logger, opts ...LoggerOption) Middleware
Constants ¶
This section is empty.
Variables ¶
View Source
var RequestIdKey ctxKeyRequestId = struct{}{}
Functions ¶
func Append ¶ added in v0.8.5
func Append(m1 []Middleware, m2 ...Middleware) http.Handler
func AppendHandler ¶ added in v0.8.5
func AppendHandler(m []Middleware, h http.Handler) http.Handler
func GetRequestId ¶
Types ¶
type LoggerOption ¶ added in v0.8.5
type LoggerOption func(l *LogReq)
func WithCompletedInfo ¶
func WithCompletedInfo() LoggerOption
func WithCustomLevel ¶ added in v0.8.5
func WithCustomLevel(url string, level logger.Level) LoggerOption
type Middleware ¶
func JsonRequestResponder ¶
func JsonResponder ¶
func JsonResponder[T any](log logger.Logger, h func() (T, error)) Middleware
func PrometheusMetrics ¶ added in v0.8.5
func PrometheusMetrics(begin *prometheus.CounterVec, finished *prometheus.HistogramVec, ) Middleware
func RequestLogger ¶
func RequestLogger(log logger.Logger, opts ...LoggerOption) Middleware
Click to show internal directories.
Click to hide internal directories.