Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigEntry(name string) string
- 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 Info(msg string, fields ...Field)
- func Infof(msg string, args ...interface{})
- func Infow(msg string, keysAndValues ...interface{})
- func InjectTraceMD(ctx interface{ ... }, md *Tracer)
- func NewContext(ctx context.Context, tracer *Tracer) context.Context
- func Panic(msg string, fields ...Field)
- func Panicf(msg string, args ...interface{})
- func Panicw(msg string, keysAndValues ...interface{})
- func Warn(msg string, fields ...Field)
- func Warnf(msg string, args ...interface{})
- func Warnw(msg string, keysAndValues ...interface{})
- type CloseFunc
- type Config
- 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) AutoLevel(confKey string)
- 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) 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
- type Tracer
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 )
View Source
var ConfigPrefix = constant.ConfigPrefix + ".logger"
View Source
var DefaultLogger = Config{ Debug: true, }.Build()
DefaultLogger default logger Biz Log debug=true as default, will be
View Source
var JupiterLogger = Config{ Debug: true, }.Build()
frame logger
Functions ¶
func ConfigEntry ¶ added in v0.3.1
func DebugEncodeLevel ¶
func DebugEncodeLevel(lv zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
DebugEncodeLevel ...
func InjectTraceMD ¶
InjectTraceMD ...
func NewContext ¶
NewContext ...
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 // Name 日志文件名称 Name string // Level 日志初始等级 Level string // 日志初始化字段 Fields []zap.Field // 是否添加调用者信息 AddCaller bool // 日志前缀 Prefix string // 日志输出文件最大长度,超过改值则截断 MaxSize int MaxAge int MaxBackup int // 日志磁盘刷盘间隔 Interval time.Duration CallerSkip int Async bool Queue bool QueueSleep time.Duration Core zapcore.Core Debug bool EncoderConfig *zapcore.EncoderConfig // contains filtered or unexported fields }
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.