logger

package
v0.0.0-...-a9d2207 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: Apache-2.0 Imports: 5 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicLogger

type BasicLogger struct {
	// contains filtered or unexported fields
}

BasicLogger uses the standard library log package for logging.

func (*BasicLogger) Debug

func (l *BasicLogger) Debug(msg string)

func (*BasicLogger) Debugf

func (l *BasicLogger) Debugf(format string, args ...interface{})

func (*BasicLogger) Error

func (l *BasicLogger) Error(msg string)

func (*BasicLogger) Errorf

func (l *BasicLogger) Errorf(format string, args ...interface{})

func (*BasicLogger) Info

func (l *BasicLogger) Info(msg string)

func (*BasicLogger) Infof

func (l *BasicLogger) Infof(format string, args ...interface{})

func (*BasicLogger) Warn

func (l *BasicLogger) Warn(msg string)

func (*BasicLogger) Warnf

func (l *BasicLogger) Warnf(format string, args ...interface{})

func (*BasicLogger) WithFields

func (l *BasicLogger) WithFields(fields ...Field) Logger

type Field

type Field struct {
	Key   string
	Value interface{}
}

Field represents a key-value pair for structured logging.

func Any

func Any(key string, value interface{}) Field

func Bool

func Bool(key string, value bool) Field

func Duration

func Duration(key string, value time.Duration) Field

func Float64

func Float64(key string, value float64) Field

func Int

func Int(key string, value int) Field

func Int64

func Int64(key string, value int64) Field

func String

func String(key string, value string) Field

Field creators.

func Time

func Time(key string, value time.Time) Field

type Logger

type Logger interface {
	Debug(msg string)
	Info(msg string)
	Warn(msg string)
	Error(msg string)
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	WithFields(fields ...Field) Logger
}

Logger interface defines the logging functionality required by the client.

func NewBasicLogger

func NewBasicLogger() Logger

NewBasicLogger creates a new BasicLogger that writes to stdout.

type NoOpLogger

type NoOpLogger struct{}

NoOpLogger is a logger that does nothing, used as a default when no logger is provided.

func (*NoOpLogger) Debug

func (l *NoOpLogger) Debug(_ string)

func (*NoOpLogger) Debugf

func (l *NoOpLogger) Debugf(_ string, _ ...interface{})

func (*NoOpLogger) Error

func (l *NoOpLogger) Error(_ string)

func (*NoOpLogger) Errorf

func (l *NoOpLogger) Errorf(_ string, _ ...interface{})

func (*NoOpLogger) Info

func (l *NoOpLogger) Info(_ string)

func (*NoOpLogger) Infof

func (l *NoOpLogger) Infof(_ string, _ ...interface{})

func (*NoOpLogger) Warn

func (l *NoOpLogger) Warn(_ string)

func (*NoOpLogger) Warnf

func (l *NoOpLogger) Warnf(_ string, _ ...interface{})

func (*NoOpLogger) WithFields

func (l *NoOpLogger) WithFields(_ ...Field) Logger

Jump to

Keyboard shortcuts

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