-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
checked message confuses AddCaller #83
Comments
In general, I'm reconsidering the implementation of |
I still think it'd be good to dynamically adjust the skip level so that wrappers outside of the core library can also be skipped. It'll probably also be more efficient since you can just check the specific level rather than getting the whole call stack. |
I think efficiency is not a major concern here, as this hopefully should only be called at initialization time. (unless you need to initialize loggers at on demand?) To me, the most important thing is that this should automatically figure out the caller, somehow, not depending on a specific skip value. I'm not sure what prashantv meant by dynamically adjusting skip level, but if that's a number that the users have to set (by manually counting the stack level), it's pretty fragile. Code could be refactored and the level could easily be wrong. |
@zhenkai This is not something you could do at initialization time, but you would need to do on every log call, since the underlying logger does not know whether it's receiving a call directly, or from a wrapped logger. Since it has to be done on every single call, efficiency is extremely important. By dynamically adjusting the skip level, I don't mean the user having to set anything manually. I'm talking about having the wrapped loggers call an API to increment the number of callers to skip. |
Interesting. I thought it's only for initializing loggers, which is the case for us. So wrapped loggers won't have to provide the number of levels to skip to this API? Otherwise, they'd still have to manage the numbers, although a bit easier as they're not managing the toal. Also, if you can make this call to the API a compile-time check, somehow, (they actually HAVE to call it), that would be great :) |
Closing as a duplicate of #40. |
AddCaller appears to run from within Check() instead of at Write() time.
this program:
generates this output on my machine:
The text was updated successfully, but these errors were encountered: