Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper public testing API #7

Merged
merged 1 commit into from
May 26, 2018
Merged

Add proper public testing API #7

merged 1 commit into from
May 26, 2018

Conversation

JeanMertz
Copy link
Contributor

Testing

This package contains a public testing API you can use if you need to assert
a log entry exists.

// TestNew calls New, but returns both the logger, and an observer that can be
// used to fetch and compare delivered logs.
TestNew(tb testing.TB, 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.
TestNewWithLevel(tb testing.TB, level zapcore.LevelEnabler, options ...zap.Option) (*zap.Logger, *observer.ObservedLogs)

see testing.go for more details.

@JeanMertz JeanMertz merged commit a177ab8 into master May 26, 2018
@JeanMertz JeanMertz deleted the tweaks branch May 26, 2018 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant