Documentation ¶
Index ¶
Constants ¶
View Source
const (
// HTTPResponseLatencyKey is the amount of time needed to produce a response to a request.
HTTPResponseLatencyKey = "http.response_latency"
)
Variables ¶
This section is empty.
Functions ¶
func Default ¶
func Default(in DefaultInput) []gin.HandlerFunc
Default returns a list of middlewares usually used by most applications. It includes: - Disaster Recovery (from panics) - Traces - Metrics - Request Logging - Error Handling
func ErrorHandler ¶
ErrorHandler handles request errors, standardizing how error responses payloads should be served.
func Logger ¶
func Logger(logger LogProvider) func(ctx *gin.Context)
Logger creates a new Logger middleware that uses Trivela's GoKit default logger.
Types ¶
type DefaultInput ¶
type DefaultInput struct { ApplicationName string Logger LogProvider }
DefaultInput encapsulates inputs to a Default call.
type LogProvider ¶
type LogProvider interface { Debug(ctx context.Context, msg string, args ...any) Info(ctx context.Context, msg string, args ...any) Warning(ctx context.Context, msg string, args ...any) Error(ctx context.Context, err error) Critical(ctx context.Context, err error) }
LogProvider defines how a logger should behave.
Click to show internal directories.
Click to hide internal directories.