logger

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknownLevel config.HoneycombLevel = iota
	DebugLevel
	InfoLevel
	WarnLevel
	ErrorLevel
	PanicLevel
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry interface {
	WithField(key string, value interface{}) Entry

	// WithString does the same thing as WithField, but is more efficient for
	// disabled log levels. (Because the value parameter doesn't escape.)
	WithString(key string, value string) Entry

	WithFields(fields map[string]interface{}) Entry
	Logf(f string, args ...interface{})
}

type HoneycombEntry

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

func (*HoneycombEntry) Logf

func (h *HoneycombEntry) Logf(f string, args ...interface{})

func (*HoneycombEntry) WithField

func (h *HoneycombEntry) WithField(key string, value interface{}) Entry

func (*HoneycombEntry) WithFields

func (h *HoneycombEntry) WithFields(fields map[string]interface{}) Entry

func (*HoneycombEntry) WithString

func (h *HoneycombEntry) WithString(key string, value string) Entry

type HoneycombLogger

type HoneycombLogger struct {
	Config            config.Config   `inject:""`
	UpstreamTransport *http.Transport `inject:"upstreamTransport"`
	Version           string          `inject:"version"`
	// contains filtered or unexported fields
}

HoneycombLogger is a Logger implementation that sends all logs to a Honeycomb dataset. It requires a HoneycombLogger section of the config to exist with three keys, LoggerHoneycombAPI, LoggerAPIKey, and LoggerDataset.

func (*HoneycombLogger) Debug

func (h *HoneycombLogger) Debug() Entry

func (*HoneycombLogger) Error

func (h *HoneycombLogger) Error() Entry

func (*HoneycombLogger) Info

func (h *HoneycombLogger) Info() Entry

func (*HoneycombLogger) SetLevel

func (h *HoneycombLogger) SetLevel(level string) error

func (*HoneycombLogger) Start

func (h *HoneycombLogger) Start() error

func (*HoneycombLogger) Stop

func (h *HoneycombLogger) Stop() error

type Logger

type Logger interface {
	Debug() Entry
	Info() Entry
	Error() Entry
	// SetLevel sets the logging level (debug, info, warn, error)
	SetLevel(level string) error
}

func GetLoggerImplementation

func GetLoggerImplementation(c config.Config) Logger

type LogrusEntry

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

func (*LogrusEntry) Logf

func (l *LogrusEntry) Logf(f string, args ...interface{})

func (*LogrusEntry) WithField

func (l *LogrusEntry) WithField(key string, value interface{}) Entry

func (*LogrusEntry) WithFields

func (l *LogrusEntry) WithFields(fields map[string]interface{}) Entry

func (*LogrusEntry) WithString

func (l *LogrusEntry) WithString(key string, value string) Entry

type LogrusLogger

type LogrusLogger struct {
	Config config.Config `inject:""`
	// contains filtered or unexported fields
}

LogrusLogger is a Logger implementation that sends all logs to stdout using the Logrus package to get nice formatting

func (*LogrusLogger) Debug

func (l *LogrusLogger) Debug() Entry

func (*LogrusLogger) Error

func (l *LogrusLogger) Error() Entry

func (*LogrusLogger) Info

func (l *LogrusLogger) Info() Entry

func (*LogrusLogger) SetLevel

func (l *LogrusLogger) SetLevel(level string) error

func (*LogrusLogger) Start

func (l *LogrusLogger) Start() error

type MockLogger

type MockLogger struct {
	Events []*MockLoggerEvent
}

func (*MockLogger) Debug

func (l *MockLogger) Debug() Entry

func (*MockLogger) Error

func (l *MockLogger) Error() Entry

func (*MockLogger) Info

func (l *MockLogger) Info() Entry

func (*MockLogger) SetLevel

func (l *MockLogger) SetLevel(level string) error

type MockLoggerEvent

type MockLoggerEvent struct {
	Fields map[string]interface{}
	// contains filtered or unexported fields
}

func (*MockLoggerEvent) Logf

func (e *MockLoggerEvent) Logf(f string, args ...interface{})

func (*MockLoggerEvent) WithField

func (e *MockLoggerEvent) WithField(key string, value interface{}) Entry

func (*MockLoggerEvent) WithFields

func (e *MockLoggerEvent) WithFields(fields map[string]interface{}) Entry

func (*MockLoggerEvent) WithString

func (e *MockLoggerEvent) WithString(key string, value string) Entry

type NullLogger

type NullLogger struct{}

func (*NullLogger) Debug

func (n *NullLogger) Debug() Entry

func (*NullLogger) Error

func (n *NullLogger) Error() Entry

func (*NullLogger) Info

func (n *NullLogger) Info() Entry

func (*NullLogger) SetLevel

func (n *NullLogger) SetLevel(string) error

type NullLoggerEntry

type NullLoggerEntry struct{}

func (*NullLoggerEntry) Logf

func (n *NullLoggerEntry) Logf(string, ...interface{})

func (*NullLoggerEntry) WithField

func (n *NullLoggerEntry) WithField(key string, value interface{}) Entry

func (*NullLoggerEntry) WithFields

func (n *NullLoggerEntry) WithFields(fields map[string]interface{}) Entry

func (*NullLoggerEntry) WithString

func (n *NullLoggerEntry) WithString(key string, value string) Entry

Jump to

Keyboard shortcuts

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