Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enabled: always must skip two levels
klog does stack unwinding in `LogSink.Enabled` to implement per-source code verbosity thresholds (`-vmodule`). This worked for `logger.Info` and `logger.Error` because the code was written such that it matches how logr is implemented (Logger.Info -> Logger.Enabled -> LogSink.Enabled). It did not work for direct calls (`if logger.Enabled`) because then the call chain is `Logger.Enabled -> LogSink.Enabled`. That callchain is less common, so to fix this problem the callchains get arranges so that all calls go through one additional intermediate level. This is unnecessary extra work, but it is necessary to avoid breaking the more common normal logging calls with klog and -vmodule.
- Loading branch information