kubernetes-sigs / kubernetes-sigs/controller-runtime

Zapr log levels don't align with glog/klog recommendations

Open
#3,081 3 comments 0 reactions 0 assignees View on GitHub
lifecycle/frozen
Dominant language
Go
Stars
3k
Forks
1.3k
Avg merge
2d 5h
Merged PRs (30d)
14

Description

The named `debug` log level of zap corresponds to the numeric value `-1`, which then gets inverted by zapr and thus corresponds to`V(1)`. At the same time, the Kubernetes logging guidelines assume `V(4)` to be debug level and `V(1)` `A reasonable default log level if you don't want verbosity`: https://github.com/kubernetes/community/blob/905825353d20c57817806dd5aab242ea6c703024/contributors/devel/sig-instrumentation/logging.md#what-method-to-use

So the mapping between the two seems off, furthermore most users of zap are likely to not be aware that the log level is an int8 under the hood and can have values outside of the defined named set. We should find a way so that the named `debug` in zap corresponds to something resembling a debug log level in the glog/klog/logr universe.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing zapr's conversion between zap levels and V-levels, then compare it with the linked Kubernetes logging guidance. Define the desired relationship for named debug and the other levels, and validate that the resulting mapping aligns with glog/klog expectations without relying on undocumented numeric values.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.