Documentation ΒΆ
Index ΒΆ
- Variables
- func AddCustomAttributes(c *gin.Context, attr slog.Attr)
- func GetRequestID(c *gin.Context) string
- func New(logger *slog.Logger) gin.HandlerFunc
- func NewWithConfig(logger *slog.Logger, config *Config) gin.HandlerFunc
- func NewWithFilters(logger *slog.Logger, filters ...Filter) gin.HandlerFunc
- type Config
- type Filter
- func Accept(filter Filter) Filter
- func AcceptHost(hosts ...string) Filter
- func AcceptHostContains(parts ...string) Filter
- func AcceptHostMatch(regs ...regexp.Regexp) Filter
- func AcceptHostPrefix(prefixs ...string) Filter
- func AcceptHostSuffix(prefixs ...string) Filter
- func AcceptMethod(methods ...string) Filter
- func AcceptPath(urls ...string) Filter
- func AcceptPathContains(parts ...string) Filter
- func AcceptPathMatch(regs ...regexp.Regexp) Filter
- func AcceptPathPrefix(prefixs ...string) Filter
- func AcceptPathSuffix(prefixs ...string) Filter
- func AcceptStatus(statuses ...int) Filter
- func AcceptStatusGreaterThan(status int) Filter
- func AcceptStatusGreaterThanOrEqual(status int) Filter
- func Ignore(filter Filter) Filter
- func IgnoreHost(hosts ...string) Filter
- func IgnoreHostContains(parts ...string) Filter
- func IgnoreHostMatch(regs ...regexp.Regexp) Filter
- func IgnoreHostPrefix(prefixs ...string) Filter
- func IgnoreHostSuffix(suffixs ...string) Filter
- func IgnoreMethod(methods ...string) Filter
- func IgnorePath(urls ...string) Filter
- func IgnorePathContains(parts ...string) Filter
- func IgnorePathMatch(regs ...regexp.Regexp) Filter
- func IgnorePathPrefix(prefixs ...string) Filter
- func IgnorePathSuffix(suffixs ...string) Filter
- func IgnoreStatus(statuses ...int) Filter
- func IgnoreStatusLessThan(status int) Filter
- func IgnoreStatusLessThanOrEqual(status int) Filter
Constants ΒΆ
This section is empty.
Variables ΒΆ
View Source
var ( RequestBodyMaxSize = 64 * 1024 // 64KB ResponseBodyMaxSize = 64 * 1024 // 64KB HiddenRequestHeaders = map[string]struct{}{ "authorization": {}, "cookie": {}, "set-cookie": {}, "x-auth-token": {}, "x-csrf-token": {}, "x-xsrf-token": {}, } HiddenResponseHeaders = map[string]struct{}{ "set-cookie": {}, } // Formatted with http.CanonicalHeaderKey RequestIDHeaderKey = "X-Request-Id" )
Functions ΒΆ
func GetRequestID ΒΆ
GetRequestID returns the request identifier
func New ΒΆ
func New(logger *slog.Logger) gin.HandlerFunc
New returns a gin.HandlerFunc (middleware) that logs requests using slog.
Requests with errors are logged using slog.Error(). Requests without errors are logged using slog.Info().
func NewWithConfig ΒΆ
func NewWithConfig(logger *slog.Logger, config *Config) gin.HandlerFunc
NewWithConfig returns a gin.HandlerFunc (middleware) that logs requests using slog.
func NewWithFilters ΒΆ
func NewWithFilters(logger *slog.Logger, filters ...Filter) gin.HandlerFunc
NewWithFilters returns a gin.HandlerFunc (middleware) that logs requests using slog.
Requests with errors are logged using slog.Error(). Requests without errors are logged using slog.Info().
Types ΒΆ
type Filter ΒΆ
func AcceptHostContains ΒΆ
func AcceptHostMatch ΒΆ
func AcceptHostPrefix ΒΆ
func AcceptHostSuffix ΒΆ
func AcceptPathContains ΒΆ
func AcceptPathMatch ΒΆ
func AcceptPathPrefix ΒΆ
func AcceptPathSuffix ΒΆ
func IgnoreHost ΒΆ
func IgnoreHostContains ΒΆ
func IgnoreHostMatch ΒΆ
func IgnoreHostPrefix ΒΆ
func IgnoreHostSuffix ΒΆ
func IgnoreMethod ΒΆ
func IgnorePath ΒΆ
func IgnorePathContains ΒΆ
func IgnorePathMatch ΒΆ
func IgnorePathPrefix ΒΆ
func IgnorePathSuffix ΒΆ
func IgnoreStatus ΒΆ
func IgnoreStatusLessThan ΒΆ
Click to show internal directories.
Click to hide internal directories.