Documentation ¶
Index ¶
- Constants
- Variables
- func DPanic(msg string, fields ...Field)
- func DPanicf(msg string, args ...interface{})
- func DPanicw(msg string, keysAndValues ...interface{})
- func Debug(msg string, fields ...Field)
- func DebugEncodeLevel(lv zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
- func Debugf(msg string, args ...interface{})
- func Debugw(msg string, keysAndValues ...interface{})
- func DefaultZapConfig() *zapcore.EncoderConfig
- func Error(msg string, fields ...Field)
- func Errorf(msg string, args ...interface{})
- func Errorw(msg string, keysAndValues ...interface{})
- func Fatal(msg string, fields ...Field)
- func Fatalf(msg string, args ...interface{})
- func Fatalw(msg string, keysAndValues ...interface{})
- func Flush() error
- func Info(msg string, fields ...Field)
- func Infof(msg string, args ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func Panic(msg string, fields ...Field)
- func Panicf(msg string, args ...interface{})
- func Panicw(msg string, keysAndValues ...interface{})
- func SetCtxParse(parser CtParserFunc)
- func Warn(msg string, fields ...Field)
- func Warnf(msg string, args ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
- type CloseFunc
- type Config
- type CtParserFunc
- type Field
- func FieldAddr(value string) Field
- func FieldAddrAny(value interface{}) Field
- func FieldAid(value string) Field
- func FieldCode(value int32) Field
- func FieldCost(value time.Duration) Field
- func FieldErr(err error) Field
- func FieldErrKind(value string) Field
- func FieldEvent(value string) Field
- func FieldExtMessage(vals ...interface{}) Field
- func FieldKey(value string) Field
- func FieldKeyAny(value interface{}) Field
- func FieldMethod(value string) Field
- func FieldMod(value string) Field
- func FieldName(value string) Field
- func FieldStack(value []byte) Field
- func FieldStringErr(err string) Field
- func FieldType(value string) Field
- func FieldValue(value string) Field
- func FieldValueAny(value interface{}) Field
- type Func
- type Level
- type Logger
- func (logger *Logger) Ctx(ctx context.Context) *Logger
- func (logger *Logger) DPanic(msg string, fields ...Field)
- func (logger *Logger) DPanicf(template string, args ...interface{})
- func (logger *Logger) DPanicw(msg string, keysAndValues ...interface{})
- func (logger *Logger) Debug(msg string, fields ...Field)
- func (logger *Logger) Debugf(template string, args ...interface{})
- func (logger *Logger) Debugw(msg string, keysAndValues ...interface{})
- func (logger *Logger) Error(msg string, fields ...Field)
- func (logger *Logger) Errorf(template string, args ...interface{})
- func (logger *Logger) Errorw(msg string, keysAndValues ...interface{})
- func (logger *Logger) Fatal(msg string, fields ...Field)
- func (logger *Logger) Fatalf(template string, args ...interface{})
- func (logger *Logger) Fatalw(msg string, keysAndValues ...interface{})
- func (logger *Logger) Flush() error
- func (logger *Logger) Info(msg string, fields ...Field)
- func (logger *Logger) Infof(template string, args ...interface{})
- func (logger *Logger) Infow(msg string, keysAndValues ...interface{})
- func (logger *Logger) IsDebugMode() bool
- func (logger *Logger) Panic(msg string, fields ...Field)
- func (logger *Logger) Panicf(template string, args ...interface{})
- func (logger *Logger) Panicw(msg string, keysAndValues ...interface{})
- func (logger *Logger) SetCtxParse(parser CtParserFunc)
- func (logger *Logger) SetLevel(lv Level)
- func (logger *Logger) StdLog() *log.Logger
- func (logger *Logger) Warn(msg string, fields ...Field)
- func (logger *Logger) Warnf(template string, args ...interface{})
- func (logger *Logger) Warnw(msg string, keysAndValues ...interface{})
- func (logger *Logger) With(fields ...Field) *Logger
Constants ¶
View Source
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel = zap.DebugLevel // InfoLevel is the default logging priority. InfoLevel = zap.InfoLevel // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel = zap.WarnLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-Level logs. ErrorLevel = zap.ErrorLevel // PanicLevel logs a message, then panics. PanicLevel = zap.PanicLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel = zap.FatalLevel )
Variables ¶
View Source
var ( // String ... String = zap.String // Any ... Any = zap.Any // Int64 ... Int64 = zap.Int64 // Int ... Int = zap.Int // Int32 ... Int32 = zap.Int32 // Uint ... Uint = zap.Uint // Duration ... Duration = zap.Duration // Durationp ... Durationp = zap.Durationp // Object ... Object = zap.Object // Namespace ... Namespace = zap.Namespace // Reflect ... Reflect = zap.Reflect // Skip ... Skip = zap.Skip() // ByteString ... ByteString = zap.ByteString )
Functions ¶
func DebugEncodeLevel ¶
func DebugEncodeLevel(lv zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
DebugEncodeLevel ...
Types ¶
type CloseFunc ¶
type CloseFunc func() error
CloseFunc should be called when the caller exits to clean up buffers.
func Buffer ¶
func Buffer(ws zapcore.WriteSyncer, bufferSize int, flushInterval time.Duration) (zapcore.WriteSyncer, CloseFunc)
Buffer wraps a WriteSyncer in a buffer to improve performance, if bufferSize = 0, we set it to defaultBufferSize if flushInterval = 0, we set it to defaultFlushInterval
type Config ¶
type Config struct { // Dir 日志输出目录 Dir string `json:"dir" toml:"dir"` // Name 日志文件名称 Name string `json:"name" toml:"name"` // Level 日志初始等级 Level string `json:"level" toml:"level"` // 日志初始化字段 Fields []zap.Field `json:"fields" toml:"fields"` // 是否添加调用者信息 AddCaller bool `json:"add_caller" toml:"addCaller"` // 日志前缀 Prefix string `json:"prefix" toml:"prefix"` // 日志输出文件最大长度,超过改值则截断 MaxSize int `json:"max_size" toml:"maxSize"` MaxAge int `json:"max_age" toml:"maxAge"` MaxBackup int `json:"max_backup" toml:"maxBackup"` // 日志磁盘刷盘间隔 Interval time.Duration `json:"internal" toml:"internal"` CallerSkip int `json:"caller_skip" toml:"callerSkip"` Async bool `json:"async" toml:"async"` Queue bool `json:"queue" toml:"queue"` QueueSleep time.Duration `json:"queue_sleep" toml:"queueSleep"` Core zapcore.Core `json:"core" toml:"core"` Debug bool `json:"debug" toml:"debug"` EncoderConfig *zapcore.EncoderConfig `json:"encoder_config" toml:"encoderConfig"` }
Config ...
type Field ¶
Func ...
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Func ...
Source Files ¶
Click to show internal directories.
Click to hide internal directories.