logger

package module
v0.0.0-...-9b686b4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

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) With

func (l *ZapLogger) With(args ...interface{}) Logger

func (*ZapLogger) WithContext

func (l *ZapLogger) WithContext(ctx context.Context) Logger

func (*ZapLogger) WithContextRaw

func (l *ZapLogger) WithContextRaw(ctx context.Context) *ZapLogger

func (*ZapLogger) WithRaw

func (l *ZapLogger) WithRaw(args ...interface{}) *ZapLogger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL