logutils

package
v1.17.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func HaveDebugTag

func HaveDebugTag(tag string) bool

func SetupVerboseLog

func SetupVerboseLog(log Log, isVerbose bool)

Types

type DebugFunc

type DebugFunc func(format string, args ...interface{})

func Debug

func Debug(tag string) DebugFunc

type Log

type Log interface {
	Fatalf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Infof(format string, args ...interface{})

	Child(name string) Log
	SetLevel(level LogLevel)
}

type LogLevel

type LogLevel int
const (
	// debug message, write to debug logs only by logutils.Debug
	LogLevelDebug LogLevel = 0

	// information messages, don't write too much messages,
	// only useful ones: they are shown when running with -v
	LogLevelInfo LogLevel = 1

	// hidden errors: non critical errors: work can be continued, no need to fail whole program;
	// tests will crash if any warning occurred.
	LogLevelWarn LogLevel = 2

	// only not hidden from user errors: whole program failing, usually
	// error logging happens in 1-2 places: in the "main" function.
	LogLevelError LogLevel = 3
)

type MockLog

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

MockLog is a mock of Log interface

func NewMockLog

func NewMockLog(ctrl *gomock.Controller) *MockLog

NewMockLog creates a new mock instance

func (*MockLog) Child

func (_m *MockLog) Child(name string) Log

Child mocks base method

func (*MockLog) EXPECT

func (_m *MockLog) EXPECT() *MockLogMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockLog) Errorf

func (_m *MockLog) Errorf(format string, args ...interface{})

Errorf mocks base method

func (*MockLog) Fatalf

func (_m *MockLog) Fatalf(format string, args ...interface{})

Fatalf mocks base method

func (*MockLog) Infof

func (_m *MockLog) Infof(format string, args ...interface{})

Infof mocks base method

func (*MockLog) SetLevel

func (_m *MockLog) SetLevel(level LogLevel)

SetLevel mocks base method

func (*MockLog) Warnf

func (_m *MockLog) Warnf(format string, args ...interface{})

Warnf mocks base method

type MockLogMockRecorder

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

MockLogMockRecorder is the mock recorder for MockLog

func (*MockLogMockRecorder) Child

func (_mr *MockLogMockRecorder) Child(arg0 interface{}) *gomock.Call

Child indicates an expected call of Child

func (*MockLogMockRecorder) Errorf

func (_mr *MockLogMockRecorder) Errorf(arg0 interface{}, arg1 ...interface{}) *gomock.Call

Errorf indicates an expected call of Errorf

func (*MockLogMockRecorder) Fatalf

func (_mr *MockLogMockRecorder) Fatalf(arg0 interface{}, arg1 ...interface{}) *gomock.Call

Fatalf indicates an expected call of Fatalf

func (*MockLogMockRecorder) Infof

func (_mr *MockLogMockRecorder) Infof(arg0 interface{}, arg1 ...interface{}) *gomock.Call

Infof indicates an expected call of Infof

func (*MockLogMockRecorder) SetLevel

func (_mr *MockLogMockRecorder) SetLevel(arg0 interface{}) *gomock.Call

SetLevel indicates an expected call of SetLevel

func (*MockLogMockRecorder) Warnf

func (_mr *MockLogMockRecorder) Warnf(arg0 interface{}, arg1 ...interface{}) *gomock.Call

Warnf indicates an expected call of Warnf

type StderrLog

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

func NewStderrLog

func NewStderrLog(name string) *StderrLog

func (StderrLog) Child

func (sl StderrLog) Child(name string) Log

func (StderrLog) Debugf

func (sl StderrLog) Debugf(format string, args ...interface{})

func (StderrLog) Errorf

func (sl StderrLog) Errorf(format string, args ...interface{})

func (StderrLog) Fatalf

func (sl StderrLog) Fatalf(format string, args ...interface{})

func (StderrLog) Infof

func (sl StderrLog) Infof(format string, args ...interface{})

func (*StderrLog) SetLevel

func (sl *StderrLog) SetLevel(level LogLevel)

func (StderrLog) Warnf

func (sl StderrLog) Warnf(format string, args ...interface{})

Jump to

Keyboard shortcuts

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