Documentation ¶
Index ¶
- func Must(zaplog *zap.Logger, err error) *zap.Logger
- func New(service, version string, options ...zap.Option) (*zap.Logger, error)
- func TestNew(tb testing.TB, options ...zap.Option) (*zap.Logger, *observer.ObservedLogs)
- func TestNewWarn(tb testing.TB, options ...zap.Option) (*zap.Logger, *observer.ObservedLogs)
- func TestNewWithLevel(tb testing.TB, level zapcore.LevelEnabler, options ...zap.Option) (*zap.Logger, *observer.ObservedLogs)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Must ¶
Must is a convenience function that takes a zaplog and error as input, panics if the error is not nil, and returns the passed in logger.
This can be used for example with `Must(zap.NewProduction())`
func TestNew ¶
TestNew calls New, but returns both the logger, and an observer that can be used to fetch and compare delivered logs.
func TestNewWarn ¶
TestNewWarn is equal to TestNew, except that it sets the minimum log level required to record an entry in the recorder to "Warn". This convenience function can be used to validate that no warnings, or errors are logged when testing a unit of code.
func TestNewWithLevel ¶
func TestNewWithLevel(tb testing.TB, level zapcore.LevelEnabler, options ...zap.Option) (*zap.Logger, *observer.ObservedLogs)
TestNewWithLevel is equal to TestNew, except that it takes an extra argument, dictating the minimum log level required to record an entry in the recorder.
Types ¶
This section is empty.