Documentation ¶
Overview ¶
Provides a transition layer from "github.com/op/go-logging" to "go.uber.org/zap" to simply resolve some reentrancy issues in go-logging.
This provides a largely api compatible layer so we can quickly drop in a replacement.
Index ¶
- Constants
- func GetLevel(name string) zapcore.Level
- func SetLevel(l zapcore.Level, name string)
- type ZapLogger
- func (z *ZapLogger) Debug(args ...interface{})
- func (z *ZapLogger) Debugf(template string, args ...interface{})
- func (z *ZapLogger) Error(args ...interface{})
- func (z *ZapLogger) Errorf(template string, args ...interface{})
- func (z *ZapLogger) Fatal(args ...interface{})
- func (z *ZapLogger) Fatalf(template string, args ...interface{})
- func (z *ZapLogger) GetLevel() zapcore.Level
- func (z *ZapLogger) Info(args ...interface{})
- func (z *ZapLogger) Infof(template string, args ...interface{})
- func (z *ZapLogger) IsEnabledFor(level zapcore.Level) bool
- func (z *ZapLogger) Logger() *zap.Logger
- func (z *ZapLogger) Notice(args ...interface{})
- func (z *ZapLogger) Noticef(template string, args ...interface{})
- func (z *ZapLogger) SetConfigAndRebuild(c zap.Config) error
- func (z *ZapLogger) SetLevel(l zapcore.Level)
- func (z *ZapLogger) SetLogger(l *zap.Logger)
- func (z *ZapLogger) SetSugar(s *zap.SugaredLogger)
- func (z *ZapLogger) Sugar() *zap.SugaredLogger
- func (z *ZapLogger) Warning(args ...interface{})
- func (z *ZapLogger) Warningf(template string, args ...interface{})
Constants ¶
const ( DEBUG = zapcore.DebugLevel INFO = zapcore.InfoLevel WARNING = zapcore.WarnLevel NOTICE = zapcore.InfoLevel // Map to info ERROR = zapcore.ErrorLevel CRITICAL = zapcore.DPanicLevel )
Mapping of go-logging to zap log levels. It's imperfect but good enough
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ZapLogger ¶
type ZapLogger struct {
// contains filtered or unexported fields
}
Zaplogger is a container to wrap zap logging with the parts of the go-logging API we use
func MustGetLogger ¶
MustGetLogger returns a new logger or panic()s
func (*ZapLogger) Debug ¶
func (z *ZapLogger) Debug(args ...interface{})
Debug logs it's arguments at log level Debug
func (*ZapLogger) Error ¶
func (z *ZapLogger) Error(args ...interface{})
Error logs it's arguments at log level Error
func (*ZapLogger) Fatal ¶
func (z *ZapLogger) Fatal(args ...interface{})
Fatal logs it's arguments at log level Fatal
func (*ZapLogger) Fatalf ¶
Fatalf logs a formatted string at log level Fatal and will then always exit()
func (*ZapLogger) Info ¶
func (z *ZapLogger) Info(args ...interface{})
Info logs it's arguments at log level Info
func (*ZapLogger) IsEnabledFor ¶
IsEnabledFor returns true if logging is enabled for the specified level
func (*ZapLogger) Notice ¶
func (z *ZapLogger) Notice(args ...interface{})
Notice logs it's arguments at log level *Info*
func (*ZapLogger) SetConfigAndRebuild ¶
SetConfigAndRebuild so you can replace the default config
func (*ZapLogger) SetSugar ¶
func (z *ZapLogger) SetSugar(s *zap.SugaredLogger)
SetSugar sets our internal Sugared logger
func (*ZapLogger) Sugar ¶
func (z *ZapLogger) Sugar() *zap.SugaredLogger
Sugar returns the internal Sugared logger