Skip to content

Add Logger class and give one to nodes#411

Merged
dhood merged 25 commits intomasterfrom
node_loggers
Dec 5, 2017
Merged

Add Logger class and give one to nodes#411
dhood merged 25 commits intomasterfrom
node_loggers

Conversation

@dhood
Copy link
Copy Markdown
Member

@dhood dhood commented Nov 30, 2017

This code change is one step in the higher-level Logging feature, see: ros2/ros2#425 for others

This adds a Logger class, the node->get_logger() method, and the rclcpp::get_logger(name) free function for non-node loggers.

Logging macros must now have a logger object passed as the first argument (instead of a name as previously accepted). I added

/// Helper function to give useful compiler errors in logging macros.
to give something more useful than a wall of macro errors if users try to pass a string: open to other implementation suggestions.

The Logger class is based off a rough implementation initially by @wjwwood. The node's logger is implemented as an interface on @Karsten1987's suggestion to support the use case of composing a lightweight Node that does not include or "pay for" the logger interface. Additionally, even if using the logger interface, logging functionality can be minimised with the preprocessor directive RCLCPP_LOGGING_ENABLED set to false.

Todo before merge:

Other todos listed in the code are planned as follow-up PRs.

ci windows Build Status

Loading
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.

4 participants