-
Notifications
You must be signed in to change notification settings - Fork 914
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
Fix stack frame identification in rospy logging. #1141
Conversation
Okay, so this is I believe in a shippable state as far as unbreaking the head of devel and passing the smoke test laid out in the first post, but it's still not super great. The new deal is:
However, it sucks because:
I think it's probably mergeable as-is, but I would propose one or more of the following future directions:
|
The updated approach looks good to me to get this working and 🚢 again. I added 8021d9e to fix the |
if f.f_back: | ||
f = f.f_back | ||
if f.f_back: | ||
f = f.f_back |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about making this "move-two-frames-up" conditional on being "our" use case with the _base_logger
?
if f.f_back and f.f_code and f.f_code.co_name == '_base_logger':
f = f.f_back
if f.f_back:
f = f.f_back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a better idea. FWIW, I can't really see a case where it would be only one layer of wrapping, so the following should be safe:
if f.f_code and f.f_code.co_name == '_base_logger':
f = f.f_back.f_back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better be safe than sorry: 64e284e
|
Looks like a legit test failure, though. Expected regex was:
Actual was:
This is likely to be fixed by 64e284e. |
Thank you @mikepurvis. This looks good to go. |
A possible solution to the issue introduced in #948.
Definitely hacky; should almost certainly be covered by some tests.
Manual verification was by means of the following trivial script:
Running this, I can
rostopic echo /rosout
and verify that all thefile:
fields point to this script name.However, in the course of playing with this, I noted that the following does not work:
It crashes on account of the throttle code's assumption that the caller is two stack frames up, whereas in this case it is only one.
FYI @ggallagher01