Skip to content
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

Merged
merged 3 commits into from
Oct 8, 2024
Merged

Added more logs #4098

merged 3 commits into from
Oct 8, 2024

Conversation

sauwming
Copy link
Member

@sauwming sauwming commented Oct 4, 2024

To continue PR #4086.

Thanks to @krishanifs for contributing the original patch.

pjlib/include/pj/assert.h Show resolved Hide resolved
# define pj_assert(expr) \
do { \
if (!(expr)) { \
PJ_LOG(1, (__FILE__, "Assert failed: %s", #expr)); \
Copy link
Member Author

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?

Copy link
Member

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?

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

Copy link
Member Author

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.

@sauwming sauwming self-assigned this Oct 4, 2024
@sauwming sauwming merged commit e8eab5e into master Oct 8, 2024
36 checks passed
@sauwming sauwming deleted the ifs-log branch October 8, 2024 04:12
LeonidGoltsblat added a commit to LeonidGoltsblat/pjproject that referenced this pull request Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants