Documentation ¶
Overview ¶
Package zlog is a wrapper for zap.
Index ¶
- func DPanic(msg string, fields Fields)
- func DPanicO(msg string, object interface{})
- func DPanicf(format string, args ...interface{})
- func Debug(msg string, fields Fields)
- func DebugO(msg string, object interface{})
- func Debugf(format string, args ...interface{})
- func Empty() bool
- func Error(msg string, fields Fields)
- func ErrorO(msg string, object interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(msg string, fields Fields)
- func FatalO(msg string, object interface{})
- func Fatalf(format string, args ...interface{})
- func Info(msg string, fields Fields)
- func InfoO(msg string, object interface{})
- func Infof(format string, args ...interface{})
- func InitLogger(config *Config)
- func Panic(msg string, fields Fields)
- func PanicO(msg string, object interface{})
- func Panicf(format string, args ...interface{})
- func Warn(msg string, fields Fields)
- func WarnO(msg string, object interface{})
- func Warnf(format string, args ...interface{})
- type Config
- type Entry
- func (e *Entry) DPanic(msg string, fields interface{})
- func (e *Entry) Debug(msg string, fields interface{})
- func (e *Entry) Error(msg string, fields interface{})
- func (e *Entry) Fatal(msg string, fields interface{})
- func (e *Entry) Fields() []zapcore.Field
- func (e *Entry) GinLogger() gin.HandlerFunc
- func (e *Entry) GinRecovery(stack bool) gin.HandlerFunc
- func (e *Entry) Info(msg string, fields interface{})
- func (e *Entry) Panic(msg string, fields interface{})
- func (e *Entry) Warn(msg string, fields interface{})
- func (e *Entry) WithContext(ctx context.Context) *Entry
- func (e *Entry) WithError(err error) *Entry
- func (e *Entry) WithEvent(event string) *Entry
- func (e *Entry) WithField(key string, value interface{}) *Entry
- func (e *Entry) WithFields(fields ...zapcore.Field) *Entry
- type Fields
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { LogPath string `mapstructure:"logPath"` AppName string `mapstructure:"appName"` Debug bool `mapstructure:"debug"` Level int8 `mapstructure:"level"` MaxSize int `mapstructure:"maxSize"` MaxAge int `mapstructure:"maxAge"` MaxBackups int `mapstructure:"maxBackups"` Compress bool `mapstructure:"compress"` }
Config 是log文件的参数配置
type Entry ¶
Entry 是对zap的一个封装
func (*Entry) GinRecovery ¶
func (e *Entry) GinRecovery(stack bool) gin.HandlerFunc
GinRecovery 是给gin框架提供访异常回复时的日志中间件;错误处理,也可以不写自己处理错误使用gin写好的错误处理
func (*Entry) WithContext ¶
WithContext 通过上下文获取跟踪ID的信息,构造一个实例
Click to show internal directories.
Click to hide internal directories.