logs

package
v0.0.0-...-d10117a Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageZapKey  string = "message"
	SeverityZapKey string = "severity"
	TimeZapKey     string = "time"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleLogger

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

func NewSimpleLogger

func NewSimpleLogger() SimpleLogger

func (SimpleLogger) Errorf

func (sl SimpleLogger) Errorf(format string, v ...any)

func (SimpleLogger) Errorw

func (sl SimpleLogger) Errorw(msg string, keysAndValues ...any)

func (SimpleLogger) Fatalf

func (sl SimpleLogger) Fatalf(format string, v ...any)

func (SimpleLogger) Infof

func (sl SimpleLogger) Infof(format string, v ...any)

func (SimpleLogger) Infow

func (sl SimpleLogger) Infow(msg string, keysAndValues ...any)

A SimpleLogger doesn't have the capability of adding metadata to the resulting log.

func (SimpleLogger) Printf

func (sl SimpleLogger) Printf(format string, v ...any)

func (SimpleLogger) Println

func (sl SimpleLogger) Println(v ...any)

func (SimpleLogger) Warnf

func (sl SimpleLogger) Warnf(format string, v ...any)

func (SimpleLogger) Warnw

func (sl SimpleLogger) Warnw(msg string, keysAndValues ...any)

type StructuredLogger

type StructuredLogger interface {
	// Infof, Warnf, Errorf use fmt.Sprintf to log a templated message.
	Infof(format string, v ...any)
	Warnf(format string, v ...any)
	Errorf(format string, v ...any)
	// Infow, Warnw, Errorw log a string message and optionally
	// can add key, value pairs of metadata to the log depending
	// on the underlying implementation of the interface.
	Infow(msg string, keysAndValues ...any)
	Warnw(msg string, keysAndValues ...any)
	Errorw(msg string, keysAndValues ...any)
	Println(v ...any)
}

type ZapStructuredLogger

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

func Default

func Default() *ZapStructuredLogger

func DiscardLogger

func DiscardLogger() (*ZapStructuredLogger, *observer.ObservedLogs)

func New

func New(file string) *ZapStructuredLogger

func (ZapStructuredLogger) Errorf

func (f ZapStructuredLogger) Errorf(format string, v ...any)

func (ZapStructuredLogger) Errorw

func (f ZapStructuredLogger) Errorw(msg string, keysAndValues ...any)

func (ZapStructuredLogger) Infof

func (f ZapStructuredLogger) Infof(format string, v ...any)

func (ZapStructuredLogger) Infow

func (f ZapStructuredLogger) Infow(msg string, keysAndValues ...any)

A zap logger has an implementation of Infow, Warnw, Errorw that will add a key, value pairs to the output json structured log. Link: https://pkg.go.dev/go.uber.org/zap#SugaredLogger.Infow

func (ZapStructuredLogger) Println

func (f ZapStructuredLogger) Println(v ...any)

func (ZapStructuredLogger) Warnf

func (f ZapStructuredLogger) Warnf(format string, v ...any)

func (ZapStructuredLogger) Warnw

func (f ZapStructuredLogger) Warnw(msg string, keysAndValues ...any)

Jump to

Keyboard shortcuts

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