Skip to content

Commit

Permalink
remove extra caller skip from logger
Browse files Browse the repository at this point in the history
  • Loading branch information
abursavich committed Aug 28, 2020
1 parent 3ad72e0 commit 755ba30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions cmd/configmapsecret-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ func main() {

logger = mzlog.NewZapLogger(logCfg)
mzlog.Process(logger)
// TODO(abursavich): remove CallerSkip when https://github.com/go-logr/zapr/issues/6 is fixed
log.SetLogger(zapr.NewLogger(logger.WithOptions(zap.AddCallerSkip(1))))
log.SetLogger(zapr.NewLogger(logger))

check(metrics.Registry.Register(logCfg.Metrics), "Unable to register logging metrics")
check(metrics.Registry.Register(buildinfo.Collector()), "Unable to register build metrics")
Expand Down
5 changes: 2 additions & 3 deletions pkg/controllers/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/machinezone/configmapsecrets/pkg/api/v1alpha1"
"github.com/machinezone/configmapsecrets/pkg/mzlog"
"github.com/onsi/gomega"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
Expand All @@ -37,8 +36,8 @@ func init() {
logCfg := mzlog.DefaultConfig()
logCfg.Level = zapcore.DebugLevel
logCfg.Encoder = mzlog.ConsoleType
// TODO(abursavich): remove CallerSkip when https://github.com/go-logr/zapr/issues/6 is fixed
log.SetLogger(zapr.NewLogger(mzlog.NewZapLogger(logCfg).WithOptions(zap.AddCallerSkip(1))))
logCfg.EnableStacktrace = false
log.SetLogger(zapr.NewLogger(mzlog.NewZapLogger(logCfg)))
}

func TestMain(m *testing.M) {
Expand Down

0 comments on commit 755ba30

Please sign in to comment.