Skip to content

Commit

Permalink
zaptest/NewLogger: Clarify default log level
Browse files Browse the repository at this point in the history
This documents that loggers built with zaptest.NewLogger default to
debug level logging.
  • Loading branch information
abhinav authored and akshayjshah committed Apr 12, 2018
1 parent a230719 commit 031c049
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion zaptest/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,15 @@ func Level(enab zapcore.LevelEnabler) LoggerOption {
// NewLogger builds a new Logger that logs all messages to the given
// testing.TB.
//
// logger := zaptest.NewLogger(t, zaptest.Level(zap.WarnLevel))
// logger := zaptest.NewLogger(t)
//
// Use this with a *testing.T or *testing.B to get logs which get printed only
// if a test fails or if you ran go test -v.
//
// The returned logger defaults to logging debug level messages and above.
// This may be changd by passing a zaptest.Level during construction.
//
// logger := zaptest.NewLogger(t, zaptest.Level(zap.WarnLevel))
func NewLogger(t TestingT, opts ...LoggerOption) *zap.Logger {
cfg := loggerOptions{
Level: zapcore.DebugLevel,
Expand Down

0 comments on commit 031c049

Please sign in to comment.