Skip to content

Commit

Permalink
Fix #6
Browse files Browse the repository at this point in the history
Use zap.AddCallerSkip to refer to the correct line caller reference/file:linenum
  • Loading branch information
naemono authored and DirectXMan12 committed Nov 5, 2019
1 parent 2e515ec commit 8f24873
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zapr.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,11 @@ func (l *zapLogger) WithName(name string) logr.Logger {

// NewLogger creates a new logr.Logger using the given Zap Logger to log.
func NewLogger(l *zap.Logger) logr.Logger {
log := l.WithOptions(zap.AddCallerSkip(1))
return &zapLogger{
l: l,
l: log,
infoLogger: infoLogger{
l: l,
l: log,
lvl: zap.InfoLevel,
},
}
Expand Down

0 comments on commit 8f24873

Please sign in to comment.