-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Enable log filtering #2844
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
base: develop
Are you sure you want to change the base?
Enable log filtering #2844
Conversation
Signed-off-by: Andrzej Turko <[email protected]>
Enable the users to decide for what kinds of log messages their log
callbacks will be called. This filtering happens in the library in
order to avoid the malloc call in log__printf (logging_mosq.c) for
messages that would be ignored anyway.
By default, no messages are filtered out. The set of allowed log types
can be configured by mosquitto_log_levels_set.
Note: Two additional log level masks (WARNING_AND_ABOVE and
NOTICE_AND_ABOVE) have been added as shortcuts for
convenience.
Signed-off-by: Andrzej Turko <[email protected]>
|
Is there something wrong with this PR? Should I have included the requirement checklist in the message? |
|
@ralight, what do you think about this change?
|
|
@ralight is there anything blocking this PR from being considered? |
028adb2 to
604b69a
Compare
b7e2d3d to
e715b04
Compare
ae502fb to
9b6f004
Compare
b612b85 to
93557bf
Compare
|
I just was reading the code and realized this was an issue. This feature would be awesome if we could get it merged into the next release. Avoiding these extra allocations would be a great improvement. |
| #define MOSQ_LOG_WARNING_AND_ABOVE (MOSQ_LOG_WARNING | MOSQ_LOG_ERR) | ||
| #define MOSQ_LOG_NOTICE_AND_ABOVE (MOSQ_LOG_WARNING_AND_ABOVE | MOSQ_LOG_NOTICE) |
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.
nitpick: Are these really necessary? A user can create these masks themselves.
Thank you. However, so far this PR has not been getting any attention from the maintainers, so for now I'm going to hold off with making changes. |
6b404a7 to
2c4967a
Compare
Enable users to decide for what kinds of log messages their log callbacks will be called. This filtering happens in the library in
order to avoid the malloc call in log__printf (logging_mosq.c) for messages that would be ignored anyway.
By default, no messages are filtered out. The set of allowed log types can be configured by mosquitto_log_levels_set.
Also, this pull request adds a unit test of this feature.
Note:
Two tests failed locally: 06-bridge-clean-session-csF-lcsT.py and c/03-publish-c2b-qos2-maximum-qos-1.test, but those were already failing before these changes.