Closed kmjayadeep closed 1 year ago
HI @kmjayadeep , this is a great description. Thank you. I am not clear about the following,
"Replace logrusr with our own implementation to support the log levels (https://github.com/bombsimon/logrusr/blob/main/logrusr.go)" and "Export log levels as constants and replace code blocks like below"
seem like the same steps to me or did I misunderstand you ?
The changes look good to me :+1:
thanks @gourishkb. I'm closing this PR. I found that it is easy to implement this with zap itself, without needing to maintain our own implementation of logr.Logger. I will raise a separate PR
@pnavali this PR was closed. Here is the new PR: https://github.com/kubeslice/worker-operator/pull/135 The new fields are added there
To introduce standard logging fields and conventions, we need to fix the following limitations with the current codebase
go-logr
logr.logger interface doesn't support log levels (they use verbose level number instead).debug
loglevel, butwarn
is missingTo fix this, this PR introduces the following changes (more PRs to follow)
zap
log.Info("something", zap.string("slice", "green"))
log.V(1).Info("App pod is not part of the slice", "pod", pod.Name, "slice", slice.Name) log.V(logger.DEBUG).Info("App pod is not part of the slice", "pod", pod.Name, "slice", slice.Name)
log.V(2).Info("App pod is not part of the slice", "pod", pod.Name, "slice", slice.Name) log.V(logger.WARN).Info("App pod is not part of the slice", "pod", pod.Name, "slice", slice.Name)