Documentation ¶
Index ¶
- func ParseLevel(levelStr string) (zerolog.Level, error)
- func SetLogger(opts ...Option) gin.HandlerFunc
- type Fn
- type Option
- func WithClientErrorLevel(lvl zerolog.Level) Option
- func WithDefaultLevel(lvl zerolog.Level) Option
- func WithLogger(fn func(*gin.Context, zerolog.Logger) zerolog.Logger) Option
- func WithPathLevel(m map[string]zerolog.Level) Option
- func WithServerErrorLevel(lvl zerolog.Level) Option
- func WithSkipPath(s []string) Option
- func WithSkipPathRegexps(regs ...*regexp.Regexp) Option
- func WithSkipper(s Skipper) Option
- func WithUTC(s bool) Option
- func WithWriter(s io.Writer) Option
- type Skipper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseLevel ¶ added in v0.2.6
ParseLevel converts a level string into a zerolog Level value. returns an error if the input string does not match known values.
func SetLogger ¶
func SetLogger(opts ...Option) gin.HandlerFunc
SetLogger initializes the logging middleware.
Types ¶
type Option ¶ added in v0.1.0
type Option interface {
// contains filtered or unexported methods
}
Option specifies instrumentation configuration options.
func WithClientErrorLevel ¶ added in v0.2.2
WithClientErrorLevel set the log level used for request with status code between 400 and 499
func WithDefaultLevel ¶ added in v0.2.2
WithDefaultLevel set the log level used for request with status code < 400
func WithLogger ¶ added in v0.1.0
WithLogger set custom logger func
func WithPathLevel ¶ added in v1.0.0
WithPathLevel use logging level for successful requests to a specific path
func WithServerErrorLevel ¶ added in v0.2.2
WithServerErrorLevel set the log level used for request with status code >= 500
func WithSkipPath ¶ added in v0.1.0
WithSkipPath skip URL path by specific pattern
func WithSkipPathRegexps ¶ added in v0.3.0
WithSkipPathRegexps multiple skip URL paths by regexp pattern
func WithSkipper ¶ added in v1.0.0
WithSkipper set function to skip middleware requests with this function returning true will not have their logs written Default is nil
func WithWriter ¶ added in v0.2.0
WithWriter change the default output writer. Default is gin.DefaultWriter