-
Notifications
You must be signed in to change notification settings - Fork 100
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
Programmatic logger severity thresholds #57
Conversation
Can't stop the log calls from being called, so handle it gracefully
This reverts commit 182b133.
It was the absence of a name; we don't prepend it to other names.
Latest CI including ros2/rclpy#130: |
this is ready for another round of review @ros2/team. everything in my previous summary is still valid (scope, points potentially up for discussion) |
[RCUTILS_LOG_SEVERITY_WARN] = "WARN", | ||
[RCUTILS_LOG_SEVERITY_ERROR] = "ERROR", | ||
[RCUTILS_LOG_SEVERITY_FATAL] = "FATAL", | ||
}; |
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 are the other entries initialized?
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.
automatically as null, there's a check for null after retrieving the values at: https://github.com/ros2/rcutils/pull/57/files/ab249daaef9556c9aa2a2b79bc0ccb4a98829b61#diff-f909d0b1a298531f76132943dc55f86aR190
src/logging.c
Outdated
return g_rcutils_logging_output_handler; | ||
} | ||
|
||
void rcutils_logging_set_output_handler(rcutils_logging_output_handler_t function) | ||
{ | ||
g_rcutils_logging_output_handler = function; | ||
RCUTILS_LOGGING_AUTOINIT | ||
g_rcutils_logging_output_handler = function; |
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.
Indentation seems to be off?
Same below.
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.
yeah this is what uncrustify wanted: I'll disable what's making it complain
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.
I allowed them to be independent as an arbitrary decision but equating them is needed to facilitate an empty-named root logger concept in wrappers
Ready for review. What's changed since the last summary is that now the empty-named logger acts as if it's the root logger: changing the severity threshold for the empty-named logger changes the default severity. This was done in order to facilitate an empty root logger in ros2/rclpy#132 (comment). The default logger's severity is still stored as a global variable, instead of in the severity map, to facilitate global configuration even when the severity map can't be used for some reason. |
@ros2/team if anyone has an idea for how I can help this be easier to review I'm open to suggestions. If it would help someone, I can provide descriptions, discussions, or break it into several PRs that build on top of each other. |
* \param[in] delimiter the character to search for | ||
* \returns the index of the first occurence of the delimiter if found, or | ||
* \returns `string_length` if the delimiter is not found, or | ||
* \returns `0` for invalid arguments |
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.
What if the delimiter is at index 0
? How do you know the difference between that and invalid arguments?
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.
Same question for findn
version.
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.
@clalancette also raised this question in #57 (comment); the conclusion was that it will be addressed as followup #58
* \param[in] delimiter the character to search for | ||
* \returns the index of the last occurence of the delimiter if found, or | ||
* \returns `string_length` if the delimiter is not found, or | ||
* \returns `0` for invalid arguments |
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.
Same question, what if delimiter is at 0
only.
include/rcutils/logging.h
Outdated
* \param name The name of the logger, must be null terminated c string or NULL. | ||
* \param severity The severity level. | ||
* | ||
* \return True if the logger is enabled for the severity; false otherwise. |
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: True
is uppercase and false
is lower, lower is correct in C++
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.
thanks, I was capitalising the sentence. fixed in 3024667
if (!rcutils_allocator_is_valid(&allocator)) { | ||
fprintf( | ||
stderr, | ||
"Provided allocator is invalid. Using the default allocator.\n"); |
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.
Since you're returning an error code should you use RCUTILS_SET_ERROR_MSG
?
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.
Same below.
@wjwwood could you please review the recent changes regarding your suggestion to use
|
I've moved the commits related to This is CI for the approved changes here and the approved ros2/rclpy#132. I'll merge. |
still in progressdescription below.