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

Programmatic logger severity thresholds #57

Merged
merged 62 commits into from
Nov 9, 2017
Merged

Programmatic logger severity thresholds #57

merged 62 commits into from
Nov 9, 2017

Conversation

dhood
Copy link
Member

@dhood dhood commented Oct 10, 2017

still in progress description below.

@dhood dhood added the in progress Actively being worked on (Kanban column) label Oct 10, 2017
@dhood dhood self-assigned this Oct 10, 2017
@dhood
Copy link
Member Author

dhood commented Oct 19, 2017

Latest CI including ros2/rclpy#130:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@dhood dhood added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Oct 19, 2017
@dhood
Copy link
Member Author

dhood commented Oct 20, 2017

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",
};
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member Author

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
@dhood
Copy link
Member Author

dhood commented Nov 2, 2017

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.

@dhood
Copy link
Member Author

dhood commented Nov 3, 2017

@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
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member Author

@dhood dhood Nov 7, 2017

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
Copy link
Member

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.

* \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.
Copy link
Member

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++

Copy link
Member Author

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");
Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same below.

@dhood
Copy link
Member Author

dhood commented Nov 7, 2017

@wjwwood could you please review the recent changes regarding your suggestion to use RCUTILS_SET_ERROR_MSG:

@dhood
Copy link
Member Author

dhood commented Nov 9, 2017

I've moved the commits related to RCUTILS_SET_ERROR_MSG into a separate PR #65 so that I can merge what has been approved here, and then we can more easily discuss the new commits.

This is CI for the approved changes here and the approved ros2/rclpy#132. I'll merge.

  • Linux Build Status
  • Linux-aarch64 Build Status (known flaky test)
  • macOS Build Status (known flaky test)
  • Windows Build Status

@dhood dhood merged commit b981951 into master Nov 9, 2017
@dhood dhood removed the in review Waiting for review (Kanban column) label Nov 9, 2017
@dhood dhood deleted the logging_config branch November 9, 2017 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants