Documentation ¶
Overview ¶
Package iriszap provides log handling using zap package.
Index ¶
- func CustomRecoveryWithZap(logger *zap.Logger, stack bool, recovery func(iris.Context, interface{})) iris.Handler
- func New(logger *zap.Logger, timeFormat string, utc bool) iris.Handler
- func NewWithConfig(logger *zap.Logger, conf *Config) iris.Handler
- func RecoveryWithZap(logger *zap.Logger, stack bool) iris.Handler
- type Config
- type Fn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CustomRecoveryWithZap ¶
func CustomRecoveryWithZap(logger *zap.Logger, stack bool, recovery func(iris.Context, interface{})) iris.Handler
CustomRecoveryWithZap returns an iris.Handler (middleware) with a custom recovery handler that recovers from any panics and logs requests using uber-go/zap. All errors are logged using zap.Error(). stack means whether output the stack info. The stack info is easy to find where the error occurs but the stack info is too large.
func New ¶
New returns an iris.Handler (middleware) that logs requests using uber-go/zap.
Requests with errors are logged using zap.Error(). Requests without errors are logged using zap.Info().
It receives:
- A time package format string (e.g. time.RFC3339).
- A boolean stating whether to use UTC time zone or local.
func NewWithConfig ¶
NewWithConfig returns an iris.Handler using configs.
func RecoveryWithZap ¶
RecoveryWithZap returns an iris.Handler (middleware) that recovers from any panics and logs requests using uber-go/zap. All errors are logged using zap.Error(). stack means whether output the stack info. The stack info is easy to find where the error occurs but the stack info is too large.