-
Notifications
You must be signed in to change notification settings - Fork 806
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
Added more logs #4098
Added more logs #4098
Conversation
pjlib/include/pj/assert.h
Outdated
# define pj_assert(expr) \ | ||
do { \ | ||
if (!(expr)) { \ | ||
PJ_LOG(1, (__FILE__, "Assert failed: %s", #expr)); \ |
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.
This is actually a good idea, but I think the reason we have never done this is that our logging functionality requires thread registration. So this may unintentionally crash the app in release build?
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.
As this is specific for pj_assert()
, perhaps we can add check whether the thread is registered?
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.
with FILE sometimes important part of the path is not visible
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.
As mentioned in the comment #4086 (comment), we had a precious PR #3889.
In summary, the proper solution is to increase PJ_LOG_SENDER _WIDTH. Alternatively, we should put the filename extraction mechanism in log.c/h since this doesn't only affect assertion but all the log printing.
To continue PR #4086.
Thanks to @krishanifs for contributing the original patch.