logger

package
v2.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 33 Imported by: 12

Documentation

Index

Constants

View Source
const (
	// SentryFlushDeadline indicates the maximum amount of time we allow sentry to
	// flush events on manual flush
	SentryFlushDeadline = 5 * time.Second
)

Variables

This section is empty.

Functions

func InitColor

func InitColor(c bool)

InitColor explicitly sets the global color.NoColor option. Not safe for concurrent use. Only to be called from init().

func StartPyroscope

func StartPyroscope(pyroConfig config.Pyroscope, pprofConfig PprofConfig) (*pyroscope.Profiler, error)

StartPyroscope starts continuous profiling of the Chainlink Node

Types

type Config

type Config struct {
	LogLevel       zapcore.Level
	Dir            string
	JsonConsole    bool
	UnixTS         bool
	FileMaxSizeMB  int
	FileMaxAgeDays int
	FileMaxBackups int // files
	// contains filtered or unexported fields
}

func (Config) DebugLogsToDisk

func (c Config) DebugLogsToDisk() bool

DebugLogsToDisk returns whether debug logs should be stored in disk

func (*Config) DiskSpaceAvailable added in v2.2.0

func (c *Config) DiskSpaceAvailable(path string) (utils.FileSize, error)

func (Config) LogsFile

func (c Config) LogsFile() string

func (*Config) New

func (c *Config) New() (Logger, func() error)

New returns a new Logger with pretty printing to stdout, prometheus counters, and sentry forwarding. Tests should use TestLogger.

func (Config) RequiredDiskSpace

func (c Config) RequiredDiskSpace() utils.FileSize

RequiredDiskSpace returns the required disk space in order to allow debug logs to be stored in disk

type Fields

type Fields map[string]interface{}

func (Fields) Merge

func (f Fields) Merge(f2 Fields) Fields

func (Fields) Slice

func (f Fields) Slice() []interface{}

func (Fields) With

func (f Fields) With(xs ...interface{}) Fields

type Logger

type Logger interface {
	// With creates a new Logger with the given arguments
	With(args ...interface{}) Logger
	// Named creates a new Logger sub-scoped with name.
	// Names are inherited and dot-separated.
	//   a := l.Named("A") // logger=A
	//   b := a.Named("A") // logger=A.B
	// Names are generally `MixedCaps`, without spaces, like Go names.
	Named(name string) Logger

	// SetLogLevel changes the log level for this and all connected Loggers.
	SetLogLevel(zapcore.Level)

	Trace(args ...interface{})
	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Critical(args ...interface{})
	Panic(args ...interface{})
	// Fatal logs and then calls os.Exit(1)
	// Be careful about using this since it does NOT unwind the stack and may
	// exit uncleanly
	Fatal(args ...interface{})

	Tracef(format string, values ...interface{})
	Debugf(format string, values ...interface{})
	Infof(format string, values ...interface{})
	Warnf(format string, values ...interface{})
	Errorf(format string, values ...interface{})
	Criticalf(format string, values ...interface{})
	Panicf(format string, values ...interface{})
	Fatalf(format string, values ...interface{})

	Tracew(msg string, keysAndValues ...interface{})
	Debugw(msg string, keysAndValues ...interface{})
	Infow(msg string, keysAndValues ...interface{})
	Warnw(msg string, keysAndValues ...interface{})
	Errorw(msg string, keysAndValues ...interface{})
	Criticalw(msg string, keysAndValues ...interface{})
	Panicw(msg string, keysAndValues ...interface{})
	Fatalw(msg string, keysAndValues ...interface{})

	// Sync flushes any buffered log entries.
	// Some insignificant errors are suppressed.
	Sync() error

	// Helper creates a new logger with the number of callers skipped by caller annotation increased by skip.
	// This allows wrappers and helpers to point higher up the stack (like testing.T.Helper()).
	Helper(skip int) Logger

	// Name returns the fully qualified name of the logger.
	Name() string

	// Recover reports recovered panics; this is useful because it avoids
	// double-reporting to sentry
	Recover(panicErr interface{})
}

Logger is the main interface of this package. It implements uber/zap's SugaredLogger interface and adds conditional logging helpers.

Loggers should be injected (and usually Named as well): e.g. lggr.Named("<service name>")

Tests

  • Tests should use a TestLogger, with NewLogger being reserved for actual runtime and limited direct testing.

Levels

  • Fatal: Logs and then calls os.Exit(1). Be careful about using this since it does NOT unwind the stack and may exit uncleanly.
  • Panic: Unrecoverable error. Example: invariant violation, programmer error
  • Critical: Requires quick action from the node op, obviously these should happen extremely rarely. Example: failed to listen on TCP port
  • Error: Something bad happened, and it was clearly on the node op side. No need for immediate action though. Example: database write timed out
  • Warn: Something bad happened, not clear who/what is at fault. Node ops should have a rough look at these once in a while to see whether anything stands out. Example: connection to peer was closed unexpectedly. observation timed out.
  • Info: High level information. First level we’d expect node ops to look at. Example: entered new epoch with leader, made an observation with value, etc.
  • Debug: Useful for forensic debugging, but we don't expect nops to look at this. Example: Got a message, dropped a message, ...
  • Trace: Only included if compiled with the trace tag. For example: go test -tags trace ...

Node Operator Docs: https://docs.chain.link/docs/configuration-variables/#log_level

var NullLogger Logger = &nullLogger{}

nolint

func NewLogger

func NewLogger() (Logger, func() error)

NewLogger returns a new Logger with default configuration. Tests should use TestLogger.

func TestLoggerObserved

func TestLoggerObserved(tb testing.TB, lvl zapcore.Level) (Logger, *observer.ObservedLogs)

TestLoggerObserved creates a logger with an observer that can be used to test emitted logs at the given level or above

Note: It is not necessary to Sync().

type MockLogger added in v2.15.0

type MockLogger struct {
	mock.Mock
}

MockLogger is an autogenerated mock type for the Logger type

func NewMockLogger added in v2.15.0

func NewMockLogger(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockLogger

NewMockLogger creates a new instance of MockLogger. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockLogger) Critical added in v2.15.0

func (_m *MockLogger) Critical(args ...interface{})

Critical provides a mock function with given fields: args

func (*MockLogger) Criticalf added in v2.15.0

func (_m *MockLogger) Criticalf(format string, values ...interface{})

Criticalf provides a mock function with given fields: format, values

func (*MockLogger) Criticalw added in v2.15.0

func (_m *MockLogger) Criticalw(msg string, keysAndValues ...interface{})

Criticalw provides a mock function with given fields: msg, keysAndValues

func (*MockLogger) Debug added in v2.15.0

func (_m *MockLogger) Debug(args ...interface{})

Debug provides a mock function with given fields: args

func (*MockLogger) Debugf added in v2.15.0

func (_m *MockLogger) Debugf(format string, values ...interface{})

Debugf provides a mock function with given fields: format, values

func (*MockLogger) Debugw added in v2.15.0

func (_m *MockLogger) Debugw(msg string, keysAndValues ...interface{})

Debugw provides a mock function with given fields: msg, keysAndValues

func (*MockLogger) EXPECT added in v2.15.0

func (_m *MockLogger) EXPECT() *MockLogger_Expecter

func (*MockLogger) Error added in v2.15.0

func (_m *MockLogger) Error(args ...interface{})

Error provides a mock function with given fields: args

func (*MockLogger) Errorf added in v2.15.0

func (_m *MockLogger) Errorf(format string, values ...interface{})

Errorf provides a mock function with given fields: format, values

func (*MockLogger) Errorw added in v2.15.0

func (_m *MockLogger) Errorw(msg string, keysAndValues ...interface{})

Errorw provides a mock function with given fields: msg, keysAndValues

func (*MockLogger) Fatal added in v2.15.0

func (_m *MockLogger) Fatal(args ...interface{})

Fatal provides a mock function with given fields: args

func (*MockLogger) Fatalf added in v2.15.0

func (_m *MockLogger) Fatalf(format string, values ...interface{})

Fatalf provides a mock function with given fields: format, values

func (*MockLogger) Fatalw added in v2.15.0

func (_m *MockLogger) Fatalw(msg string, keysAndValues ...interface{})

Fatalw provides a mock function with given fields: msg, keysAndValues

func (*MockLogger) Helper added in v2.15.0

func (_m *MockLogger) Helper(skip int) Logger

Helper provides a mock function with given fields: skip

func (*MockLogger) Info added in v2.15.0

func (_m *MockLogger) Info(args ...interface{})

Info provides a mock function with given fields: args

func (*MockLogger) Infof added in v2.15.0

func (_m *MockLogger) Infof(format string, values ...interface{})

Infof provides a mock function with given fields: format, values

func (*MockLogger) Infow added in v2.15.0

func (_m *MockLogger) Infow(msg string, keysAndValues ...interface{})

Infow provides a mock function with given fields: msg, keysAndValues

func (*MockLogger) Name added in v2.15.0

func (_m *MockLogger) Name() string

Name provides a mock function with given fields:

func (*MockLogger) Named added in v2.15.0

func (_m *MockLogger) Named(name string) Logger

Named provides a mock function with given fields: name

func (*MockLogger) Panic added in v2.15.0

func (_m *MockLogger) Panic(args ...interface{})

Panic provides a mock function with given fields: args

func (*MockLogger) Panicf added in v2.15.0

func (_m *MockLogger) Panicf(format string, values ...interface{})

Panicf provides a mock function with given fields: format, values

func (*MockLogger) Panicw added in v2.15.0

func (_m *MockLogger) Panicw(msg string, keysAndValues ...interface{})

Panicw provides a mock function with given fields: msg, keysAndValues

func (*MockLogger) Recover added in v2.15.0

func (_m *MockLogger) Recover(panicErr interface{})

Recover provides a mock function with given fields: panicErr

func (*MockLogger) SetLogLevel added in v2.15.0

func (_m *MockLogger) SetLogLevel(_a0 zapcore.Level)

SetLogLevel provides a mock function with given fields: _a0

func (*MockLogger) Sync added in v2.15.0

func (_m *MockLogger) Sync() error

Sync provides a mock function with given fields:

func (*MockLogger) Trace added in v2.15.0

func (_m *MockLogger) Trace(args ...interface{})

Trace provides a mock function with given fields: args

func (*MockLogger) Tracef added in v2.15.0

func (_m *MockLogger) Tracef(format string, values ...interface{})

Tracef provides a mock function with given fields: format, values

func (*MockLogger) Tracew added in v2.15.0

func (_m *MockLogger) Tracew(msg string, keysAndValues ...interface{})

Tracew provides a mock function with given fields: msg, keysAndValues

func (*MockLogger) Warn added in v2.15.0

func (_m *MockLogger) Warn(args ...interface{})

Warn provides a mock function with given fields: args

func (*MockLogger) Warnf added in v2.15.0

func (_m *MockLogger) Warnf(format string, values ...interface{})

Warnf provides a mock function with given fields: format, values

func (*MockLogger) Warnw added in v2.15.0

func (_m *MockLogger) Warnw(msg string, keysAndValues ...interface{})

Warnw provides a mock function with given fields: msg, keysAndValues

func (*MockLogger) With added in v2.15.0

func (_m *MockLogger) With(args ...interface{}) Logger

With provides a mock function with given fields: args

type MockLogger_Critical_Call added in v2.15.0

type MockLogger_Critical_Call struct {
	*mock.Call
}

MockLogger_Critical_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Critical'

func (*MockLogger_Critical_Call) Return added in v2.15.0

func (*MockLogger_Critical_Call) Run added in v2.15.0

func (_c *MockLogger_Critical_Call) Run(run func(args ...interface{})) *MockLogger_Critical_Call

func (*MockLogger_Critical_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Critical_Call) RunAndReturn(run func(...interface{})) *MockLogger_Critical_Call

type MockLogger_Criticalf_Call added in v2.15.0

type MockLogger_Criticalf_Call struct {
	*mock.Call
}

MockLogger_Criticalf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Criticalf'

func (*MockLogger_Criticalf_Call) Return added in v2.15.0

func (*MockLogger_Criticalf_Call) Run added in v2.15.0

func (_c *MockLogger_Criticalf_Call) Run(run func(format string, values ...interface{})) *MockLogger_Criticalf_Call

func (*MockLogger_Criticalf_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Criticalf_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Criticalf_Call

type MockLogger_Criticalw_Call added in v2.15.0

type MockLogger_Criticalw_Call struct {
	*mock.Call
}

MockLogger_Criticalw_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Criticalw'

func (*MockLogger_Criticalw_Call) Return added in v2.15.0

func (*MockLogger_Criticalw_Call) Run added in v2.15.0

func (_c *MockLogger_Criticalw_Call) Run(run func(msg string, keysAndValues ...interface{})) *MockLogger_Criticalw_Call

func (*MockLogger_Criticalw_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Criticalw_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Criticalw_Call

type MockLogger_Debug_Call added in v2.15.0

type MockLogger_Debug_Call struct {
	*mock.Call
}

MockLogger_Debug_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Debug'

func (*MockLogger_Debug_Call) Return added in v2.15.0

func (*MockLogger_Debug_Call) Run added in v2.15.0

func (_c *MockLogger_Debug_Call) Run(run func(args ...interface{})) *MockLogger_Debug_Call

func (*MockLogger_Debug_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Debug_Call) RunAndReturn(run func(...interface{})) *MockLogger_Debug_Call

type MockLogger_Debugf_Call added in v2.15.0

type MockLogger_Debugf_Call struct {
	*mock.Call
}

MockLogger_Debugf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Debugf'

func (*MockLogger_Debugf_Call) Return added in v2.15.0

func (*MockLogger_Debugf_Call) Run added in v2.15.0

func (_c *MockLogger_Debugf_Call) Run(run func(format string, values ...interface{})) *MockLogger_Debugf_Call

func (*MockLogger_Debugf_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Debugf_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Debugf_Call

type MockLogger_Debugw_Call added in v2.15.0

type MockLogger_Debugw_Call struct {
	*mock.Call
}

MockLogger_Debugw_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Debugw'

func (*MockLogger_Debugw_Call) Return added in v2.15.0

func (*MockLogger_Debugw_Call) Run added in v2.15.0

func (_c *MockLogger_Debugw_Call) Run(run func(msg string, keysAndValues ...interface{})) *MockLogger_Debugw_Call

func (*MockLogger_Debugw_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Debugw_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Debugw_Call

type MockLogger_Error_Call added in v2.15.0

type MockLogger_Error_Call struct {
	*mock.Call
}

MockLogger_Error_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Error'

func (*MockLogger_Error_Call) Return added in v2.15.0

func (*MockLogger_Error_Call) Run added in v2.15.0

func (_c *MockLogger_Error_Call) Run(run func(args ...interface{})) *MockLogger_Error_Call

func (*MockLogger_Error_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Error_Call) RunAndReturn(run func(...interface{})) *MockLogger_Error_Call

type MockLogger_Errorf_Call added in v2.15.0

type MockLogger_Errorf_Call struct {
	*mock.Call
}

MockLogger_Errorf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Errorf'

func (*MockLogger_Errorf_Call) Return added in v2.15.0

func (*MockLogger_Errorf_Call) Run added in v2.15.0

func (_c *MockLogger_Errorf_Call) Run(run func(format string, values ...interface{})) *MockLogger_Errorf_Call

func (*MockLogger_Errorf_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Errorf_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Errorf_Call

type MockLogger_Errorw_Call added in v2.15.0

type MockLogger_Errorw_Call struct {
	*mock.Call
}

MockLogger_Errorw_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Errorw'

func (*MockLogger_Errorw_Call) Return added in v2.15.0

func (*MockLogger_Errorw_Call) Run added in v2.15.0

func (_c *MockLogger_Errorw_Call) Run(run func(msg string, keysAndValues ...interface{})) *MockLogger_Errorw_Call

func (*MockLogger_Errorw_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Errorw_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Errorw_Call

type MockLogger_Expecter added in v2.15.0

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

func (*MockLogger_Expecter) Critical added in v2.15.0

func (_e *MockLogger_Expecter) Critical(args ...interface{}) *MockLogger_Critical_Call

Critical is a helper method to define mock.On call

  • args ...interface{}

func (*MockLogger_Expecter) Criticalf added in v2.15.0

func (_e *MockLogger_Expecter) Criticalf(format interface{}, values ...interface{}) *MockLogger_Criticalf_Call

Criticalf is a helper method to define mock.On call

  • format string
  • values ...interface{}

func (*MockLogger_Expecter) Criticalw added in v2.15.0

func (_e *MockLogger_Expecter) Criticalw(msg interface{}, keysAndValues ...interface{}) *MockLogger_Criticalw_Call

Criticalw is a helper method to define mock.On call

  • msg string
  • keysAndValues ...interface{}

func (*MockLogger_Expecter) Debug added in v2.15.0

func (_e *MockLogger_Expecter) Debug(args ...interface{}) *MockLogger_Debug_Call

Debug is a helper method to define mock.On call

  • args ...interface{}

func (*MockLogger_Expecter) Debugf added in v2.15.0

func (_e *MockLogger_Expecter) Debugf(format interface{}, values ...interface{}) *MockLogger_Debugf_Call

Debugf is a helper method to define mock.On call

  • format string
  • values ...interface{}

func (*MockLogger_Expecter) Debugw added in v2.15.0

func (_e *MockLogger_Expecter) Debugw(msg interface{}, keysAndValues ...interface{}) *MockLogger_Debugw_Call

Debugw is a helper method to define mock.On call

  • msg string
  • keysAndValues ...interface{}

func (*MockLogger_Expecter) Error added in v2.15.0

func (_e *MockLogger_Expecter) Error(args ...interface{}) *MockLogger_Error_Call

Error is a helper method to define mock.On call

  • args ...interface{}

func (*MockLogger_Expecter) Errorf added in v2.15.0

func (_e *MockLogger_Expecter) Errorf(format interface{}, values ...interface{}) *MockLogger_Errorf_Call

Errorf is a helper method to define mock.On call

  • format string
  • values ...interface{}

func (*MockLogger_Expecter) Errorw added in v2.15.0

func (_e *MockLogger_Expecter) Errorw(msg interface{}, keysAndValues ...interface{}) *MockLogger_Errorw_Call

Errorw is a helper method to define mock.On call

  • msg string
  • keysAndValues ...interface{}

func (*MockLogger_Expecter) Fatal added in v2.15.0

func (_e *MockLogger_Expecter) Fatal(args ...interface{}) *MockLogger_Fatal_Call

Fatal is a helper method to define mock.On call

  • args ...interface{}

func (*MockLogger_Expecter) Fatalf added in v2.15.0

func (_e *MockLogger_Expecter) Fatalf(format interface{}, values ...interface{}) *MockLogger_Fatalf_Call

Fatalf is a helper method to define mock.On call

  • format string
  • values ...interface{}

func (*MockLogger_Expecter) Fatalw added in v2.15.0

func (_e *MockLogger_Expecter) Fatalw(msg interface{}, keysAndValues ...interface{}) *MockLogger_Fatalw_Call

Fatalw is a helper method to define mock.On call

  • msg string
  • keysAndValues ...interface{}

func (*MockLogger_Expecter) Helper added in v2.15.0

func (_e *MockLogger_Expecter) Helper(skip interface{}) *MockLogger_Helper_Call

Helper is a helper method to define mock.On call

  • skip int

func (*MockLogger_Expecter) Info added in v2.15.0

func (_e *MockLogger_Expecter) Info(args ...interface{}) *MockLogger_Info_Call

Info is a helper method to define mock.On call

  • args ...interface{}

func (*MockLogger_Expecter) Infof added in v2.15.0

func (_e *MockLogger_Expecter) Infof(format interface{}, values ...interface{}) *MockLogger_Infof_Call

Infof is a helper method to define mock.On call

  • format string
  • values ...interface{}

func (*MockLogger_Expecter) Infow added in v2.15.0

func (_e *MockLogger_Expecter) Infow(msg interface{}, keysAndValues ...interface{}) *MockLogger_Infow_Call

Infow is a helper method to define mock.On call

  • msg string
  • keysAndValues ...interface{}

func (*MockLogger_Expecter) Name added in v2.15.0

Name is a helper method to define mock.On call

func (*MockLogger_Expecter) Named added in v2.15.0

func (_e *MockLogger_Expecter) Named(name interface{}) *MockLogger_Named_Call

Named is a helper method to define mock.On call

  • name string

func (*MockLogger_Expecter) Panic added in v2.15.0

func (_e *MockLogger_Expecter) Panic(args ...interface{}) *MockLogger_Panic_Call

Panic is a helper method to define mock.On call

  • args ...interface{}

func (*MockLogger_Expecter) Panicf added in v2.15.0

func (_e *MockLogger_Expecter) Panicf(format interface{}, values ...interface{}) *MockLogger_Panicf_Call

Panicf is a helper method to define mock.On call

  • format string
  • values ...interface{}

func (*MockLogger_Expecter) Panicw added in v2.15.0

func (_e *MockLogger_Expecter) Panicw(msg interface{}, keysAndValues ...interface{}) *MockLogger_Panicw_Call

Panicw is a helper method to define mock.On call

  • msg string
  • keysAndValues ...interface{}

func (*MockLogger_Expecter) Recover added in v2.15.0

func (_e *MockLogger_Expecter) Recover(panicErr interface{}) *MockLogger_Recover_Call

Recover is a helper method to define mock.On call

  • panicErr interface{}

func (*MockLogger_Expecter) SetLogLevel added in v2.15.0

func (_e *MockLogger_Expecter) SetLogLevel(_a0 interface{}) *MockLogger_SetLogLevel_Call

SetLogLevel is a helper method to define mock.On call

  • _a0 zapcore.Level

func (*MockLogger_Expecter) Sync added in v2.15.0

Sync is a helper method to define mock.On call

func (*MockLogger_Expecter) Trace added in v2.15.0

func (_e *MockLogger_Expecter) Trace(args ...interface{}) *MockLogger_Trace_Call

Trace is a helper method to define mock.On call

  • args ...interface{}

func (*MockLogger_Expecter) Tracef added in v2.15.0

func (_e *MockLogger_Expecter) Tracef(format interface{}, values ...interface{}) *MockLogger_Tracef_Call

Tracef is a helper method to define mock.On call

  • format string
  • values ...interface{}

func (*MockLogger_Expecter) Tracew added in v2.15.0

func (_e *MockLogger_Expecter) Tracew(msg interface{}, keysAndValues ...interface{}) *MockLogger_Tracew_Call

Tracew is a helper method to define mock.On call

  • msg string
  • keysAndValues ...interface{}

func (*MockLogger_Expecter) Warn added in v2.15.0

func (_e *MockLogger_Expecter) Warn(args ...interface{}) *MockLogger_Warn_Call

Warn is a helper method to define mock.On call

  • args ...interface{}

func (*MockLogger_Expecter) Warnf added in v2.15.0

func (_e *MockLogger_Expecter) Warnf(format interface{}, values ...interface{}) *MockLogger_Warnf_Call

Warnf is a helper method to define mock.On call

  • format string
  • values ...interface{}

func (*MockLogger_Expecter) Warnw added in v2.15.0

func (_e *MockLogger_Expecter) Warnw(msg interface{}, keysAndValues ...interface{}) *MockLogger_Warnw_Call

Warnw is a helper method to define mock.On call

  • msg string
  • keysAndValues ...interface{}

func (*MockLogger_Expecter) With added in v2.15.0

func (_e *MockLogger_Expecter) With(args ...interface{}) *MockLogger_With_Call

With is a helper method to define mock.On call

  • args ...interface{}

type MockLogger_Fatal_Call added in v2.15.0

type MockLogger_Fatal_Call struct {
	*mock.Call
}

MockLogger_Fatal_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Fatal'

func (*MockLogger_Fatal_Call) Return added in v2.15.0

func (*MockLogger_Fatal_Call) Run added in v2.15.0

func (_c *MockLogger_Fatal_Call) Run(run func(args ...interface{})) *MockLogger_Fatal_Call

func (*MockLogger_Fatal_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Fatal_Call) RunAndReturn(run func(...interface{})) *MockLogger_Fatal_Call

type MockLogger_Fatalf_Call added in v2.15.0

type MockLogger_Fatalf_Call struct {
	*mock.Call
}

MockLogger_Fatalf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Fatalf'

func (*MockLogger_Fatalf_Call) Return added in v2.15.0

func (*MockLogger_Fatalf_Call) Run added in v2.15.0

func (_c *MockLogger_Fatalf_Call) Run(run func(format string, values ...interface{})) *MockLogger_Fatalf_Call

func (*MockLogger_Fatalf_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Fatalf_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Fatalf_Call

type MockLogger_Fatalw_Call added in v2.15.0

type MockLogger_Fatalw_Call struct {
	*mock.Call
}

MockLogger_Fatalw_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Fatalw'

func (*MockLogger_Fatalw_Call) Return added in v2.15.0

func (*MockLogger_Fatalw_Call) Run added in v2.15.0

func (_c *MockLogger_Fatalw_Call) Run(run func(msg string, keysAndValues ...interface{})) *MockLogger_Fatalw_Call

func (*MockLogger_Fatalw_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Fatalw_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Fatalw_Call

type MockLogger_Helper_Call added in v2.15.0

type MockLogger_Helper_Call struct {
	*mock.Call
}

MockLogger_Helper_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Helper'

func (*MockLogger_Helper_Call) Return added in v2.15.0

func (*MockLogger_Helper_Call) Run added in v2.15.0

func (_c *MockLogger_Helper_Call) Run(run func(skip int)) *MockLogger_Helper_Call

func (*MockLogger_Helper_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Helper_Call) RunAndReturn(run func(int) Logger) *MockLogger_Helper_Call

type MockLogger_Info_Call added in v2.15.0

type MockLogger_Info_Call struct {
	*mock.Call
}

MockLogger_Info_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Info'

func (*MockLogger_Info_Call) Return added in v2.15.0

func (*MockLogger_Info_Call) Run added in v2.15.0

func (_c *MockLogger_Info_Call) Run(run func(args ...interface{})) *MockLogger_Info_Call

func (*MockLogger_Info_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Info_Call) RunAndReturn(run func(...interface{})) *MockLogger_Info_Call

type MockLogger_Infof_Call added in v2.15.0

type MockLogger_Infof_Call struct {
	*mock.Call
}

MockLogger_Infof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Infof'

func (*MockLogger_Infof_Call) Return added in v2.15.0

func (*MockLogger_Infof_Call) Run added in v2.15.0

func (_c *MockLogger_Infof_Call) Run(run func(format string, values ...interface{})) *MockLogger_Infof_Call

func (*MockLogger_Infof_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Infof_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Infof_Call

type MockLogger_Infow_Call added in v2.15.0

type MockLogger_Infow_Call struct {
	*mock.Call
}

MockLogger_Infow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Infow'

func (*MockLogger_Infow_Call) Return added in v2.15.0

func (*MockLogger_Infow_Call) Run added in v2.15.0

func (_c *MockLogger_Infow_Call) Run(run func(msg string, keysAndValues ...interface{})) *MockLogger_Infow_Call

func (*MockLogger_Infow_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Infow_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Infow_Call

type MockLogger_Name_Call added in v2.15.0

type MockLogger_Name_Call struct {
	*mock.Call
}

MockLogger_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'

func (*MockLogger_Name_Call) Return added in v2.15.0

func (*MockLogger_Name_Call) Run added in v2.15.0

func (_c *MockLogger_Name_Call) Run(run func()) *MockLogger_Name_Call

func (*MockLogger_Name_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Name_Call) RunAndReturn(run func() string) *MockLogger_Name_Call

type MockLogger_Named_Call added in v2.15.0

type MockLogger_Named_Call struct {
	*mock.Call
}

MockLogger_Named_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Named'

func (*MockLogger_Named_Call) Return added in v2.15.0

func (*MockLogger_Named_Call) Run added in v2.15.0

func (_c *MockLogger_Named_Call) Run(run func(name string)) *MockLogger_Named_Call

func (*MockLogger_Named_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Named_Call) RunAndReturn(run func(string) Logger) *MockLogger_Named_Call

type MockLogger_Panic_Call added in v2.15.0

type MockLogger_Panic_Call struct {
	*mock.Call
}

MockLogger_Panic_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Panic'

func (*MockLogger_Panic_Call) Return added in v2.15.0

func (*MockLogger_Panic_Call) Run added in v2.15.0

func (_c *MockLogger_Panic_Call) Run(run func(args ...interface{})) *MockLogger_Panic_Call

func (*MockLogger_Panic_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Panic_Call) RunAndReturn(run func(...interface{})) *MockLogger_Panic_Call

type MockLogger_Panicf_Call added in v2.15.0

type MockLogger_Panicf_Call struct {
	*mock.Call
}

MockLogger_Panicf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Panicf'

func (*MockLogger_Panicf_Call) Return added in v2.15.0

func (*MockLogger_Panicf_Call) Run added in v2.15.0

func (_c *MockLogger_Panicf_Call) Run(run func(format string, values ...interface{})) *MockLogger_Panicf_Call

func (*MockLogger_Panicf_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Panicf_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Panicf_Call

type MockLogger_Panicw_Call added in v2.15.0

type MockLogger_Panicw_Call struct {
	*mock.Call
}

MockLogger_Panicw_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Panicw'

func (*MockLogger_Panicw_Call) Return added in v2.15.0

func (*MockLogger_Panicw_Call) Run added in v2.15.0

func (_c *MockLogger_Panicw_Call) Run(run func(msg string, keysAndValues ...interface{})) *MockLogger_Panicw_Call

func (*MockLogger_Panicw_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Panicw_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Panicw_Call

type MockLogger_Recover_Call added in v2.15.0

type MockLogger_Recover_Call struct {
	*mock.Call
}

MockLogger_Recover_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Recover'

func (*MockLogger_Recover_Call) Return added in v2.15.0

func (*MockLogger_Recover_Call) Run added in v2.15.0

func (_c *MockLogger_Recover_Call) Run(run func(panicErr interface{})) *MockLogger_Recover_Call

func (*MockLogger_Recover_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Recover_Call) RunAndReturn(run func(interface{})) *MockLogger_Recover_Call

type MockLogger_SetLogLevel_Call added in v2.15.0

type MockLogger_SetLogLevel_Call struct {
	*mock.Call
}

MockLogger_SetLogLevel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetLogLevel'

func (*MockLogger_SetLogLevel_Call) Return added in v2.15.0

func (*MockLogger_SetLogLevel_Call) Run added in v2.15.0

func (*MockLogger_SetLogLevel_Call) RunAndReturn added in v2.15.0

type MockLogger_Sync_Call added in v2.15.0

type MockLogger_Sync_Call struct {
	*mock.Call
}

MockLogger_Sync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Sync'

func (*MockLogger_Sync_Call) Return added in v2.15.0

func (*MockLogger_Sync_Call) Run added in v2.15.0

func (_c *MockLogger_Sync_Call) Run(run func()) *MockLogger_Sync_Call

func (*MockLogger_Sync_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Sync_Call) RunAndReturn(run func() error) *MockLogger_Sync_Call

type MockLogger_Trace_Call added in v2.15.0

type MockLogger_Trace_Call struct {
	*mock.Call
}

MockLogger_Trace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Trace'

func (*MockLogger_Trace_Call) Return added in v2.15.0

func (*MockLogger_Trace_Call) Run added in v2.15.0

func (_c *MockLogger_Trace_Call) Run(run func(args ...interface{})) *MockLogger_Trace_Call

func (*MockLogger_Trace_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Trace_Call) RunAndReturn(run func(...interface{})) *MockLogger_Trace_Call

type MockLogger_Tracef_Call added in v2.15.0

type MockLogger_Tracef_Call struct {
	*mock.Call
}

MockLogger_Tracef_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Tracef'

func (*MockLogger_Tracef_Call) Return added in v2.15.0

func (*MockLogger_Tracef_Call) Run added in v2.15.0

func (_c *MockLogger_Tracef_Call) Run(run func(format string, values ...interface{})) *MockLogger_Tracef_Call

func (*MockLogger_Tracef_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Tracef_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Tracef_Call

type MockLogger_Tracew_Call added in v2.15.0

type MockLogger_Tracew_Call struct {
	*mock.Call
}

MockLogger_Tracew_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Tracew'

func (*MockLogger_Tracew_Call) Return added in v2.15.0

func (*MockLogger_Tracew_Call) Run added in v2.15.0

func (_c *MockLogger_Tracew_Call) Run(run func(msg string, keysAndValues ...interface{})) *MockLogger_Tracew_Call

func (*MockLogger_Tracew_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Tracew_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Tracew_Call

type MockLogger_Warn_Call added in v2.15.0

type MockLogger_Warn_Call struct {
	*mock.Call
}

MockLogger_Warn_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Warn'

func (*MockLogger_Warn_Call) Return added in v2.15.0

func (*MockLogger_Warn_Call) Run added in v2.15.0

func (_c *MockLogger_Warn_Call) Run(run func(args ...interface{})) *MockLogger_Warn_Call

func (*MockLogger_Warn_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Warn_Call) RunAndReturn(run func(...interface{})) *MockLogger_Warn_Call

type MockLogger_Warnf_Call added in v2.15.0

type MockLogger_Warnf_Call struct {
	*mock.Call
}

MockLogger_Warnf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Warnf'

func (*MockLogger_Warnf_Call) Return added in v2.15.0

func (*MockLogger_Warnf_Call) Run added in v2.15.0

func (_c *MockLogger_Warnf_Call) Run(run func(format string, values ...interface{})) *MockLogger_Warnf_Call

func (*MockLogger_Warnf_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Warnf_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Warnf_Call

type MockLogger_Warnw_Call added in v2.15.0

type MockLogger_Warnw_Call struct {
	*mock.Call
}

MockLogger_Warnw_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Warnw'

func (*MockLogger_Warnw_Call) Return added in v2.15.0

func (*MockLogger_Warnw_Call) Run added in v2.15.0

func (_c *MockLogger_Warnw_Call) Run(run func(msg string, keysAndValues ...interface{})) *MockLogger_Warnw_Call

func (*MockLogger_Warnw_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_Warnw_Call) RunAndReturn(run func(string, ...interface{})) *MockLogger_Warnw_Call

type MockLogger_With_Call added in v2.15.0

type MockLogger_With_Call struct {
	*mock.Call
}

MockLogger_With_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'With'

func (*MockLogger_With_Call) Return added in v2.15.0

func (*MockLogger_With_Call) Run added in v2.15.0

func (_c *MockLogger_With_Call) Run(run func(args ...interface{})) *MockLogger_With_Call

func (*MockLogger_With_Call) RunAndReturn added in v2.15.0

func (_c *MockLogger_With_Call) RunAndReturn(run func(...interface{}) Logger) *MockLogger_With_Call

type PprofConfig added in v2.3.0

type PprofConfig interface {
	BlockProfileRate() int
	MutexProfileFraction() int
}

type PrettyConsole

type PrettyConsole struct {
	zap.Sink
}

PrettyConsole wraps a Sink (Writer, Syncer, Closer), usually stdout, and formats the incoming json bytes with colors and white space for readability before passing on to the underlying Writer in Sink.

func (PrettyConsole) Close

func (pc PrettyConsole) Close() error

Close is overridden to prevent accidental closure of stderr/stdout

func (PrettyConsole) Write

func (pc PrettyConsole) Write(b []byte) (int, error)

Write reformats the incoming json bytes with colors, newlines and whitespace for better readability in console.

type SugaredLogger

type SugaredLogger interface {
	Logger
	// AssumptionViolation variants log at error level with the message prefix "AssumptionViolation: ".
	AssumptionViolation(args ...interface{})
	AssumptionViolationf(format string, vals ...interface{})
	AssumptionViolationw(msg string, keyvals ...interface{})
	// ErrorIf logs the error if present.
	ErrorIf(err error, msg string)
	// ErrorIfFn calls fn() and logs any returned error along with msg.
	// Unlike ErrorIf, this can be deffered inline, since the function call is delayed.
	ErrorIfFn(fn func() error, msg string)
}

SugaredLogger extends the base Logger interface with syntactic sugar, similar to zap.SugaredLogger.

func Sugared

func Sugared(l Logger) SugaredLogger

Sugared returns a new SugaredLogger wrapping the given Logger.

func TestLogger

func TestLogger(tb testing.TB) SugaredLogger

TestLogger creates a logger that directs output to PrettyConsole configured for test output, and to the buffer testMemoryLog. t is optional. Log level is DEBUG by default.

Note: It is not necessary to Sync().

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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