Skip to content

Commit

Permalink
Update to latest Zap APIs
Browse files Browse the repository at this point in the history
Trying to stay on top of this so we don't get hit with upgrade
nightmares when we need to upgrade our next dependency.
  • Loading branch information
ascandella committed Dec 7, 2016
1 parent cb95eaa commit 1b0d2fb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
14 changes: 7 additions & 7 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package: go.uber.org/fx
import:
- package: github.com/uber-go/zap
# TODO(ai): Pin to semver range after 1.0 is released
version: master
# TODO(glib): Tally pinned for the time being until we've updated to the new API
- package: github.com/uber-go/tally
version: 2750b4ae690cbeb294016efe18ceaeb80c4ce17c
Expand Down
8 changes: 4 additions & 4 deletions ulog/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ type Log interface {
// Fatal logs at Fatal level with message, and parameters as key value pairs
Fatal(message string, keyvals ...interface{})

// DFatal logs at Debug level (Fatal for development) with message, and parameters as key value pairs
DFatal(message string, keyvals ...interface{})
// DPanic logs at Debug level (Fatal for development) with message, and parameters as key value pairs
DPanic(message string, keyvals ...interface{})
}

var _std = defaultLogger()
Expand Down Expand Up @@ -131,8 +131,8 @@ func (l *baselogger) Fatal(message string, keyvals ...interface{}) {
l.Log(zap.FatalLevel, message, keyvals...)
}

func (l *baselogger) DFatal(message string, keyvals ...interface{}) {
l.log.DFatal(message, l.fieldsConversion(keyvals...)...)
func (l *baselogger) DPanic(message string, keyvals ...interface{}) {
l.log.DPanic(message, l.fieldsConversion(keyvals...)...)
}

func (l *baselogger) Log(lvl zap.Level, message string, keyvals ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions ulog/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ func TestLoggerWithInvalidFields(t *testing.T) {
log := Builder().SetLogger(zaplogger).Build()
log.Info("info message", "c")
log.Info("info message", "c", "d", "e")
log.DFatal("debug message")
log.DPanic("debug message")
assert.Equal(t, []string{
`{"level":"info","msg":"info message","error":"invalid number of arguments"}`,
`{"level":"info","msg":"info message","error":"invalid number of arguments"}`,
`{"level":"error","msg":"debug message"}`,
`{"level":"dpanic","msg":"debug message"}`,
}, buf.Lines(), "Incorrect output from logger")
})
}
Expand Down

0 comments on commit 1b0d2fb

Please sign in to comment.