Documentation
¶
Index ¶
- Constants
- func Error(err error) zap.Field
- func Int(k string, v int) zap.Field
- func String(k, v string) zap.Field
- func Uint32(k string, v uint32) zap.Field
- type Logger
- type ZapLogger
- func (l *ZapLogger) Debug(msg string, fields ...zap.Field)
- func (l *ZapLogger) DebugWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) Error(msg string, fields ...zap.Field)
- func (l *ZapLogger) ErrorWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) Fatal(msg string, fields ...zap.Field)
- func (l *ZapLogger) FatalWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) Info(msg string, fields ...zap.Field)
- func (l *ZapLogger) InfoWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) Panic(msg string, fields ...zap.Field)
- func (l *ZapLogger) PanicWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) Warn(msg string, fields ...zap.Field)
- func (l *ZapLogger) WarnWithContext(ctx context.Context, msg string, fields ...zap.Field)
- func (l *ZapLogger) With(fields ...zap.Field)
Constants ¶
View Source
const (
// MaxDepthBacktraceStack defines the maximum back trace depth in logger
MaxDepthBacktraceStack = 8
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger interface {
// These are ops that call directly to the actual zap implementation
Debug(string, ...zap.Field)
Info(string, ...zap.Field)
Warn(string, ...zap.Field)
Error(string, ...zap.Field)
Panic(string, ...zap.Field)
Fatal(string, ...zap.Field)
// These are the equivalent logger function but with context provided
DebugWithContext(context.Context, string, ...zap.Field)
InfoWithContext(context.Context, string, ...zap.Field)
WarnWithContext(context.Context, string, ...zap.Field)
ErrorWithContext(context.Context, string, ...zap.Field)
PanicWithContext(context.Context, string, ...zap.Field)
FatalWithContext(context.Context, string, ...zap.Field)
}
type ZapLogger ¶
ZapLogger is an implementation of Logger that uses the uber/zap logger underneath. It provides additional methods such as ones that logs based on context.
func NewJSONLogger ¶ added in v0.1.1
func NewNoopLogger ¶
func NewNoopLogger() *ZapLogger
NewNoopLogger provides noop logger that satisfies the logger interface.
func NewTextLogger ¶ added in v0.1.1
func (*ZapLogger) DebugWithContext ¶
func (*ZapLogger) ErrorWithContext ¶
func (*ZapLogger) FatalWithContext ¶
func (*ZapLogger) InfoWithContext ¶
func (*ZapLogger) PanicWithContext ¶
func (*ZapLogger) WarnWithContext ¶
Click to show internal directories.
Click to hide internal directories.