log

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReplayLogger

func NewReplayLogger(logger log.Logger, isReplay *bool, enableLoggingInReplay *bool) log.Logger

NewReplayLogger crates new instance of ReplayLogger.

func With

func With(logger log.Logger, keyvals ...interface{}) log.Logger

With returns Logger instance that prepend every log entry with keyvals. If logger implments WithLogger it is used, otherwise every log call will be intercepted.

Types

type DefaultLogger

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

DefaultLogger is Logger implementation on top of standart log.Logger. It is used if logger is not specified.

func NewDefaultLogger

func NewDefaultLogger() *DefaultLogger

NewDefaultLogger creates new instance of DefaultLogger.

func (*DefaultLogger) Debug

func (l *DefaultLogger) Debug(msg string, keyvals ...interface{})

Debug writes message to the log.

func (*DefaultLogger) Error

func (l *DefaultLogger) Error(msg string, keyvals ...interface{})

Error writes message to the log.

func (*DefaultLogger) Info

func (l *DefaultLogger) Info(msg string, keyvals ...interface{})

Info writes message to the log.

func (*DefaultLogger) Warn

func (l *DefaultLogger) Warn(msg string, keyvals ...interface{})

Warn writes message to the log.

func (*DefaultLogger) With

func (l *DefaultLogger) With(keyvals ...interface{}) log.Logger

With returns new logger the prepend every log entry with keyvals.

type MemoryLogger

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

MemoryLogger is Logger implementation that stores logs in memory (useful for testing). Use Lines() to get log lines.

func NewMemoryLogger

func NewMemoryLogger() *MemoryLogger

NewMemoryLogger creates new instance of MemoryLogger.

func (*MemoryLogger) Debug

func (l *MemoryLogger) Debug(msg string, keyvals ...interface{})

Debug appends message to the log.

func (*MemoryLogger) Error

func (l *MemoryLogger) Error(msg string, keyvals ...interface{})

Error appends message to the log.

func (*MemoryLogger) Info

func (l *MemoryLogger) Info(msg string, keyvals ...interface{})

Info appends message to the log.

func (*MemoryLogger) Lines

func (l *MemoryLogger) Lines() []string

Lines returns written log lines.

func (*MemoryLogger) Warn

func (l *MemoryLogger) Warn(msg string, keyvals ...interface{})

Warn appends message to the log.

func (*MemoryLogger) With

func (l *MemoryLogger) With(keyvals ...interface{}) log.Logger

With returns new logger the prepend every log entry with keyvals.

type NopLogger

type NopLogger struct {
}

NopLogger is Logger implementation that doesn't produce any logs.

func NewNopLogger

func NewNopLogger() *NopLogger

NewNopLogger creates new instance of NopLogger.

func (*NopLogger) Debug

func (l *NopLogger) Debug(msg string, keyvals ...interface{})

Debug does nothing.

func (*NopLogger) Error

func (l *NopLogger) Error(msg string, keyvals ...interface{})

Error does nothing.

func (*NopLogger) Info

func (l *NopLogger) Info(msg string, keyvals ...interface{})

Info does nothing.

func (*NopLogger) Warn

func (l *NopLogger) Warn(msg string, keyvals ...interface{})

Warn does nothing.

func (*NopLogger) With

func (l *NopLogger) With(keyvals ...interface{}) log.Logger

With returns new NopLogger.

type ReplayLogger

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

ReplayLogger is Logger implementation that is aware of replay.

func (*ReplayLogger) Debug

func (l *ReplayLogger) Debug(msg string, keyvals ...interface{})

Debug writes message to the log if it is not a replay.

func (*ReplayLogger) Error

func (l *ReplayLogger) Error(msg string, keyvals ...interface{})

Error writes message to the log if it is not a replay.

func (*ReplayLogger) Info

func (l *ReplayLogger) Info(msg string, keyvals ...interface{})

Info writes message to the log if it is not a replay.

func (*ReplayLogger) Warn

func (l *ReplayLogger) Warn(msg string, keyvals ...interface{})

Warn writes message to the log if it is not a replay.

func (*ReplayLogger) With

func (l *ReplayLogger) With(keyvals ...interface{}) log.Logger

With returns new logger the prepend every log entry with keyvals.

type TestReporter

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

TestReporter is a log adapter for gomock.

func NewTestReporter

func NewTestReporter(logger log.Logger) *TestReporter

NewTestReporter creates new instance of TestReporter.

func (*TestReporter) Errorf

func (t *TestReporter) Errorf(format string, args ...interface{})

Errorf writes error to the log.

func (*TestReporter) Fatalf

func (t *TestReporter) Fatalf(format string, args ...interface{})

Fatalf writes error to the log and exits.

Jump to

Keyboard shortcuts

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