Skip to content

Debug logs should not use magic number level 1 V(1) #228

@kaovilai

Description

@kaovilai

logger.V(1).Info("NonAdminBackup Reconcile start")

Perhaps per https://pkg.go.dev/github.com/go-logr/zapr#hdr-Implementation_Details

Levels in logr correspond to custom debug levels in Zap. Any given level in logr is represents by its inverse in zap (zapLevel = -1*logrLevel). For example V(2) is equivalent to log level -2 in Zap, while V(1) is equivalent to Zap's DebugLevel.

Basically use zapcore.DebugLevel with an adapter function to inverse the number.. so zap.DebugLevel will return -1 and we *(-1) it when used with logr.Logger.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions