logger

package
v0.118.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithDetails

func ContextWithDetails(ctx context.Context, details Details) context.Context

func Debug

func Debug(ctx context.Context, msg string, ds ...Details)

func Error

func Error(ctx context.Context, msg string, ds ...Details)

func Fatal

func Fatal(ctx context.Context, msg string, ds ...Details)

func Info

func Info(ctx context.Context, msg string, ds ...Details)

func Stub

func Stub(tb TestingTB) *bytes.Buffer

func Warn

func Warn(ctx context.Context, msg string, ds ...Details)

Types

type Details

type Details map[string]any

func (Details) Merge

func (f Details) Merge(oth Details)

type Logger

type Logger struct {
	Out io.Writer

	Separator string

	MessageKey   string
	LevelKey     string
	TimestampKey string

	// MarshalFunc is used to serialise the logging message event.
	// When nil it defaults to JSON format.
	MarshalFunc func(any) ([]byte, error)
}
var Default Logger

func (Logger) Debug

func (l Logger) Debug(ctx context.Context, msg string, ds ...Details)

func (Logger) Error

func (l Logger) Error(ctx context.Context, msg string, ds ...Details)

func (Logger) Fatal

func (l Logger) Fatal(ctx context.Context, msg string, ds ...Details)

func (Logger) Info

func (l Logger) Info(ctx context.Context, msg string, ds ...Details)

func (Logger) Warn

func (l Logger) Warn(ctx context.Context, msg string, ds ...Details)

type TestingTB

type TestingTB interface {
	Helper()
	Cleanup(func())
}

Jump to

Keyboard shortcuts

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