In the following code pattern, the log message will get logged with v=0 in JSON output although conceptually it has a higher verbosity: if klog.V(5).Enabled() { klog.Info("hello world") } Having the actual verbosity in the JSON output is relevant, for example for filtering out only the important info messages. The solution is to use klog.V(5).Info or something similar. Whether the outer if is necessary at all depends on how complex the parameters are. The return value of klog.V can be captured in a variable and be used multiple times to avoid the overhead for that function call and to avoid repeating the verbosity level. Kubernetes-commit: 9eaa2dc554e0c3d4485d4c916dfdbc2f517db2e0 |
||
---|---|---|
.. | ||
doc.go | ||
httplog.go | ||
httplog_test.go |