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 DefaultDebugConfig() *zapcore.EncoderConfig
- 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 Component
- func (logger *Component) AutoLevel(confKey string)
- func (logger *Component) DPanic(msg string, fields ...Field)
- func (logger *Component) DPanicf(template string, args ...interface{})
- func (logger *Component) DPanicw(msg string, keysAndValues ...interface{})
- func (logger *Component) Debug(msg string, fields ...Field)
- func (logger *Component) Debugf(template string, args ...interface{})
- func (logger *Component) Debugw(msg string, keysAndValues ...interface{})
- func (logger *Component) Error(msg string, fields ...Field)
- func (logger *Component) Errorf(template string, args ...interface{})
- func (logger *Component) Errorw(msg string, keysAndValues ...interface{})
- func (logger *Component) Fatal(msg string, fields ...Field)
- func (logger *Component) Fatalf(template string, args ...interface{})
- func (logger *Component) Fatalw(msg string, keysAndValues ...interface{})
- func (logger *Component) Flush() error
- func (logger *Component) Info(msg string, fields ...Field)
- func (logger *Component) Infof(template string, args ...interface{})
- func (logger *Component) Infow(msg string, keysAndValues ...interface{})
- func (logger *Component) IsDebugMode() bool
- func (logger *Component) Panic(msg string, fields ...Field)
- func (logger *Component) Panicf(template string, args ...interface{})
- func (logger *Component) Panicw(msg string, keysAndValues ...interface{})
- func (logger *Component) SetLevel(lv Level)
- func (logger *Component) StdLog() *log.Logger
- func (logger *Component) Warn(msg string, fields ...Field)
- func (logger *Component) Warnf(template string, args ...interface{})
- func (logger *Component) Warnw(msg string, keysAndValues ...interface{})
- func (logger *Component) With(fields ...Field) *Component
- type Config
- type Container
- type Field
- func FieldAddr(value string) Field
- func FieldCode(value int32) Field
- func FieldComponent(value string) Field
- func FieldComponentName(value string) 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 FieldMethod(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 Option
- type Tracer
Constants ¶
View Source
const ( DefaultLoggerName = "default.log" // 默认业务日志名称 EgoLoggerName = "ego.sys" // 框架日志名称 )
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 )
View Source
const PackageName = "core.elog"
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 ...
func DefaultDebugConfig ¶
func DefaultDebugConfig() *zapcore.EncoderConfig
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 Component ¶
type Component struct {
// contains filtered or unexported fields
}
Func ...
var DefaultLogger *Component
DefaultLogger default logger Biz Log debug=true as default, will be
var EgoLogger *Component
frame logger
type Config ¶
type Config struct { Debug bool // 配置文件控制日志输出到终端还是文件,true到终端,false到文件 Dir string // 日志输出目录,默认logs Name string // 日志文件名称,默认框架日志mocro.sys,业务日志default.log Level string // 日志初始等级,默认info级别 AddCaller bool // 是否添加调用者信息,默认不加调用者信息 MaxSize int // 日志输出文件最大长度,超过改值则截断,默认500M MaxAge int // 日志存储最大时间,默认最大保存天数为7天 MaxBackup int // 日志存储最大数量,默认最大保存文件个数为10个 Interval time.Duration // 日志轮转时间,默认1天 Async bool // 是否异步,默认异步 FlushBufferSize int // 缓冲大小,默认256 * 1024B FlushBufferInterval time.Duration // 缓冲时间,默认5秒 Fields []zap.Field // 日志初始化字段 CallerSkip int Core zapcore.Core EncoderConfig *zapcore.EncoderConfig // contains filtered or unexported fields }
Config ...
type Container ¶
type Container struct { Config *Config // contains filtered or unexported fields }
func DefaultContainer ¶
func DefaultContainer() *Container
Source Files
¶
Click to show internal directories.
Click to hide internal directories.