logger

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 10 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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

func (h *HoneycombLogger) Debug() Entry

func (*HoneycombLogger) Error added in v0.10.0

func (h *HoneycombLogger) Error() Entry

func (*HoneycombLogger) Info added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

func (l *LogrusLogger) Debug() Entry

func (*LogrusLogger) Error added in v0.10.0

func (l *LogrusLogger) Error() Entry

func (*LogrusLogger) Info added in v0.10.0

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 added in v0.9.0

type MockLogger struct {
	Events []*MockLoggerEvent
}

func (*MockLogger) Debug added in v0.10.0

func (l *MockLogger) Debug() Entry

func (*MockLogger) Error added in v0.10.0

func (l *MockLogger) Error() Entry

func (*MockLogger) Info added in v0.10.0

func (l *MockLogger) Info() Entry

func (*MockLogger) SetLevel added in v0.9.0

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

type MockLoggerEvent added in v0.9.0

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

func (*MockLoggerEvent) Logf added in v0.10.0

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

func (*MockLoggerEvent) WithField added in v0.9.0

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

func (*MockLoggerEvent) WithFields added in v0.9.0

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

func (*MockLoggerEvent) WithString added in v0.10.0

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

type NullLogger

type NullLogger struct{}

func (*NullLogger) Debug added in v0.10.0

func (n *NullLogger) Debug() Entry

func (*NullLogger) Error added in v0.10.0

func (n *NullLogger) Error() Entry

func (*NullLogger) Info added in v0.10.0

func (n *NullLogger) Info() Entry

func (*NullLogger) SetLevel

func (n *NullLogger) SetLevel(string) error

type NullLoggerEntry

type NullLoggerEntry struct{}

func (*NullLoggerEntry) Logf added in v0.10.0

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 added in v0.10.0

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