Documentation ¶
Index ¶
- Constants
- func ActivateSpec(spec string)
- func DefaultLevel() string
- func Init(config Config)
- func IsValidLevel(level string) bool
- func LoggerLevel(loggerName string) string
- func NameToLevel(level string) zapcore.Level
- func NewZapLogger(core zapcore.Core, options ...zap.Option) *zap.Logger
- func Reset()
- func SetWriter(w io.Writer) io.Writer
- type Config
- type Encoding
- type EncodingSelector
- type HyperchainLogger
- func (hl *HyperchainLogger) Debug(args ...interface{})
- func (hl *HyperchainLogger) Debugf(template string, args ...interface{})
- func (hl *HyperchainLogger) Debugw(msg string, kvs ...interface{})
- func (hl *HyperchainLogger) Error(args ...interface{})
- func (hl *HyperchainLogger) Errorf(template string, args ...interface{})
- func (hl *HyperchainLogger) Errorw(msg string, kvs ...interface{})
- func (hl *HyperchainLogger) Info(args ...interface{})
- func (hl *HyperchainLogger) Infof(template string, args ...interface{})
- func (hl *HyperchainLogger) Infow(msg string, kvs ...interface{})
- func (hl *HyperchainLogger) IsEnabledFor(level zapcore.Level) bool
- func (hl *HyperchainLogger) Named(name string) *HyperchainLogger
- func (hl *HyperchainLogger) Panic(args ...interface{})
- func (hl *HyperchainLogger) Panicf(template string, args ...interface{})
- func (hl *HyperchainLogger) Panicw(msg string, kvs ...interface{})
- func (hl *HyperchainLogger) Warn(args ...interface{})
- func (hl *HyperchainLogger) Warnf(template string, args ...interface{})
- func (hl *HyperchainLogger) Warnw(msg string, kvs ...interface{})
- func (hl *HyperchainLogger) With(args ...interface{}) *HyperchainLogger
- type LoggerLevels
- type Logging
- func (l *Logging) Apply(c Config) error
- func (l *Logging) Check(e zapcore.Entry, ce *zapcore.CheckedEntry)
- func (l *Logging) Encoding() Encoding
- func (l *Logging) Logger(name string) *HyperchainLogger
- func (l *Logging) SetFormat(format string) error
- func (l *Logging) SetObserver(o Observer) Observer
- func (l *Logging) SetWriter(w io.Writer) io.Writer
- func (l *Logging) Sync() error
- func (l *Logging) Write(b []byte) (int, error)
- func (l *Logging) WriteEntry(e zapcore.Entry, fields []zapcore.Field)
- func (l *Logging) ZapLogger(name string) *zap.Logger
- type Observer
Constants ¶
View Source
const ( CONSOLE = iota JSON LOGFMT )
View Source
const (
DefaultFormat = "" /* 159-byte string literal not displayed */
)
View Source
const DisabledLevel = zapcore.Level(math.MinInt8)
View Source
const (
ShortFuncFormat = "" /* 160-byte string literal not displayed */
)
Variables ¶
This section is empty.
Functions ¶
func ActivateSpec ¶
func ActivateSpec(spec string)
ActivateSpec 接收的字符串 spec 的格式是:logger1,logger2=level:logger3=level:level。没有指定 logger 的 level 会被作为默认日志等级。
func DefaultLevel ¶
func DefaultLevel() string
func IsValidLevel ¶
func NameToLevel ¶
NameToLevel 如果给定的字符串 level 所指示的日志等级是未知的,则返回 InfoLevel,否则返回与 level 对应的 zapcore.Level。
Types ¶
type EncodingSelector ¶
type EncodingSelector interface {
Encoding() Encoding
}
type HyperchainLogger ¶
type HyperchainLogger struct {
// contains filtered or unexported fields
}
func MustGetLogger ¶
func MustGetLogger(loggerName string) *HyperchainLogger
func NewHyperchainLogger ¶
func NewHyperchainLogger(l *zap.Logger, options ...zap.Option) *HyperchainLogger
func (*HyperchainLogger) Debug ¶
func (hl *HyperchainLogger) Debug(args ...interface{})
func (*HyperchainLogger) Debugf ¶
func (hl *HyperchainLogger) Debugf(template string, args ...interface{})
func (*HyperchainLogger) Debugw ¶
func (hl *HyperchainLogger) Debugw(msg string, kvs ...interface{})
func (*HyperchainLogger) Error ¶
func (hl *HyperchainLogger) Error(args ...interface{})
func (*HyperchainLogger) Errorf ¶
func (hl *HyperchainLogger) Errorf(template string, args ...interface{})
func (*HyperchainLogger) Errorw ¶
func (hl *HyperchainLogger) Errorw(msg string, kvs ...interface{})
func (*HyperchainLogger) Info ¶
func (hl *HyperchainLogger) Info(args ...interface{})
func (*HyperchainLogger) Infof ¶
func (hl *HyperchainLogger) Infof(template string, args ...interface{})
func (*HyperchainLogger) Infow ¶
func (hl *HyperchainLogger) Infow(msg string, kvs ...interface{})
func (*HyperchainLogger) IsEnabledFor ¶
func (hl *HyperchainLogger) IsEnabledFor(level zapcore.Level) bool
func (*HyperchainLogger) Named ¶
func (hl *HyperchainLogger) Named(name string) *HyperchainLogger
func (*HyperchainLogger) Panic ¶
func (hl *HyperchainLogger) Panic(args ...interface{})
func (*HyperchainLogger) Panicf ¶
func (hl *HyperchainLogger) Panicf(template string, args ...interface{})
func (*HyperchainLogger) Panicw ¶
func (hl *HyperchainLogger) Panicw(msg string, kvs ...interface{})
func (*HyperchainLogger) Warn ¶
func (hl *HyperchainLogger) Warn(args ...interface{})
func (*HyperchainLogger) Warnf ¶
func (hl *HyperchainLogger) Warnf(template string, args ...interface{})
func (*HyperchainLogger) Warnw ¶
func (hl *HyperchainLogger) Warnw(msg string, kvs ...interface{})
func (*HyperchainLogger) With ¶
func (hl *HyperchainLogger) With(args ...interface{}) *HyperchainLogger
type LoggerLevels ¶
type LoggerLevels struct {
// contains filtered or unexported fields
}
func (*LoggerLevels) ActivateSpec ¶
func (ll *LoggerLevels) ActivateSpec(spec string) error
ActivateSpec 接收的字符串 spec 的格式是:logger1,logger2=level:logger3=level:level。没有指定 logger 的 level 会被作为默认日志等级。
func (*LoggerLevels) DefaultLevel ¶
func (ll *LoggerLevels) DefaultLevel() zapcore.Level
func (*LoggerLevels) Enabled ¶
func (ll *LoggerLevels) Enabled(lvl zapcore.Level) bool
Enabled 判断给定的日志等级 level 是否高于或等于 LoggerLevels 的 minLevel。
func (*LoggerLevels) Level ¶
func (ll *LoggerLevels) Level(loggerName string) zapcore.Level
Level 返回与给定的 loggerName 绑定的日志等级,首先从缓冲区中寻找有没有存储 loggerName:level,如果没有,那么再递归地从 specs 中寻找,例如给定的 loggerName 是 aaa.bbb.ccc,在 specs 中存储了 aaa.bbb:InfoLevel,那么返回的日志记录等级就是 InfoLevel。
func (*LoggerLevels) Spec ¶
func (ll *LoggerLevels) Spec() string
type Logging ¶
type Logging struct { *LoggerLevels // contains filtered or unexported fields }
var Global *Logging
func NewLogging ¶
func (*Logging) Logger ¶
func (l *Logging) Logger(name string) *HyperchainLogger
func (*Logging) SetObserver ¶
Click to show internal directories.
Click to hide internal directories.