-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabled + stack unwinding #215
Comments
My initial reaction was that I'll check with klog, which does stack unwinding in I noticed because I am using the |
I did indeed adapt to this in kubernetes/klog@125ecfe. The |
Why does Enabled() care about call depth? |
Because
Here |
Ahh, I see. It's not that Error() or Info() find the wrong caller, but some (out of tree) implementations of Enabled() need to know the caller. We can either inline the impl of Enabled() into Info/Error or we can force them all thru a common helper and document why. Or we can just document it, but that seems unfortunate |
We have to make it consistent, otherwise Let's not decide yet, I first want to test this with klog. |
We should not need to break anything - we might need to change the depth that is passed to init |
RuntimeInfo.CallDepth is documented as:
It's 1, which is correct for the
LogSink.Info
andLogSink.Error
calls, e.g.logr/logr.go
Line 278 in eea184c
But it is not correct for the
LogSink.Enabled
call inLogger.Info
:logr/logr.go
Line 274 in eea184c
There the call chain is
<user code> -> Logger.Info -> Logger.Enabled -> LogSink.Enabled
.It is correct again for
<user code> -> Logger.Enabled -> LogSink.Enabled
.The text was updated successfully, but these errors were encountered: