Documentation ¶
Overview ¶
Package ginzap provides log handling using zap package. Code structure based on ginrus package. Gin的日志由zap进行处理
Index ¶
- func DPanic(args ...interface{})
- func DPanicf(format string, args ...interface{})
- func DPanicw(msg string, args ...interface{})
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Debugw(msg string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorw(msg string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Fatalw(msg string, args ...interface{})
- func GinZap(logger *zap.Logger) gin.HandlerFunc
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Infow(msg string, args ...interface{})
- func NewZap() *zap.Logger
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Panicw(msg string, args ...interface{})
- func RecoveryWithZap(logger *zap.Logger, stack bool) gin.HandlerFunc
- func SetLoggerLevel(level string)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Warnw(msg string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GinZap ¶
func GinZap(logger *zap.Logger) gin.HandlerFunc
Ginzap returns a gin.HandlerFunc (middleware) that logs requests using uber-go/zap. Requests with errors are logged using zap.Error(). Requests without errors are logged using zap.Info().
func RecoveryWithZap ¶
func RecoveryWithZap(logger *zap.Logger, stack bool) gin.HandlerFunc
RecoveryWithZap returns a gin.HandlerFunc (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.
func SetLoggerLevel ¶
func SetLoggerLevel(level string)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.