Documentation ¶
Index ¶
- type ContextField
- type Logger
- type ZapLogger
- func (l *ZapLogger) SetContextKey(fields ...ContextField) Logger
- func (l *ZapLogger) SetContextKeyRaw(fields ...ContextField) *ZapLogger
- func (l *ZapLogger) With(args ...interface{}) Logger
- func (l *ZapLogger) WithContext(ctx context.Context) Logger
- func (l *ZapLogger) WithContextRaw(ctx context.Context) *ZapLogger
- func (l *ZapLogger) WithRaw(args ...interface{}) *ZapLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextField ¶
type ContextField struct { Label string ContextKey interface{} }
type Logger ¶
type Logger interface { Debug(i ...interface{}) Debugf(format string, args ...interface{}) Debugw(msg string, keysAndValues ...interface{}) Info(i ...interface{}) Infof(format string, args ...interface{}) Infow(msg string, keysAndValues ...interface{}) Warn(i ...interface{}) Warnf(format string, args ...interface{}) Warnw(msg string, keysAndValues ...interface{}) Error(i ...interface{}) Errorf(format string, args ...interface{}) Errorw(msg string, keysAndValues ...interface{}) Fatal(i ...interface{}) Fatalf(format string, args ...interface{}) Fatalw(msg string, keysAndValues ...interface{}) Panic(i ...interface{}) Panicf(format string, args ...interface{}) Panicw(msg string, keysAndValues ...interface{}) With(args ...interface{}) Logger // SetContextKey creates a new logger that inherites logging context and fields is overridden. // Fields are used when WithContext is called // to pull value from context.Context and to add label-value pairs to logging context. SetContextKey(fields ...ContextField) Logger // WithContext creates a child logger and adds strutured context. // It uses []ContextField which is set with SetContextKey to build logging context. // Structure is list of key-value pair // where key is ContextField.Label and value is retrieved by context#Value(ContextField.ContextKey). WithContext(ctx context.Context) Logger }
type ZapLogger ¶
type ZapLogger struct { *zap.SugaredLogger // contains filtered or unexported fields }
func NewZapLogger ¶
func NewZapLogger(sugar *zap.SugaredLogger) *ZapLogger
func (*ZapLogger) SetContextKey ¶
func (l *ZapLogger) SetContextKey(fields ...ContextField) Logger
func (*ZapLogger) SetContextKeyRaw ¶
func (l *ZapLogger) SetContextKeyRaw(fields ...ContextField) *ZapLogger
func (*ZapLogger) WithContextRaw ¶
Click to show internal directories.
Click to hide internal directories.