Conversation
790d9db to
d6a0b66
Compare
13e7e91 to
916b226
Compare
93e978e to
dde08f5
Compare
|
Ready for review. This demo adds a node using log calls that configures its logger level programmatically. There's also a component that responds to service requests for changes to the logger severity. This can be added to component-based systems to enable external logger configuration at runtime. I've tried to make it clear in the readme that this isn't the long-term plan for runtime configuration, just something that people might find useful. If we think it sends the wrong message we can just flat out say we only support programmatic configuration instead. The readme has the usage: https://github.com/ros2/demos/pull/194/files#diff-599b8049677d7c1e29b69de5f3aef287 |
mikaelarguedas
left a comment
There was a problem hiding this comment.
I looked only at the code and will review the readme and try the instructions in the next pass.
| endif() | ||
|
|
||
| if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
| add_compile_options(-Wall -Wextra) |
There was a problem hiding this comment.
Nit: Adding a comment here explaining why we cant use pedantic like the other repos will be useful for book keeping
logging_demo/CMakeLists.txt
Outdated
| macro(tests) | ||
| set(LOGGING_DEMO_MAIN_EXECUTABLE $<TARGET_FILE:logging_demo_main>) | ||
| set(EXPECTED_OUTPUT_LOGGING_DEMO_MAIN_DEFAULT_SEVERITY "${CMAKE_CURRENT_SOURCE_DIR}/test/logging_demo_main_default_severity") | ||
| set(EXPECTED_OUTPUT_LOGGING_DEMO_MAIN_DEBUG_SEVERITY "${CMAKE_CURRENT_SOURCE_DIR}/test/logging_demo_main_debug_severity") |
There was a problem hiding this comment.
Nit: these two lines look long
| @@ -0,0 +1,37 @@ | |||
| // Copyright 2016 Open Source Robotics Foundation, Inc. | |||
| #define LOGGING_DEMO__LOGGER_CONFIG_COMPONENT_HPP_ | ||
|
|
||
| #include "logging_demo/visibility_control.h" | ||
| #include "logging_demo/srv/config_logger.hpp" |
logging_demo/package.xml
Outdated
| <package format="2"> | ||
| <name>logging_demo</name> | ||
| <version>0.0.3</version> | ||
| <description>Examples for composing multiple nodes in a single process.</description> |
There was a problem hiding this comment.
The description should be updated, maintainer tag as well
There was a problem hiding this comment.
do you think it's alright to start this at v0.0.3? figured it's easier for when we bump them all?
There was a problem hiding this comment.
All packages in the same repository need to have the same version, so not keeping it in line with the other package's version would actually make it impossible to release :)
|
|
||
| configure_file( | ||
| test/test_logging_demo.py.in | ||
| test_logging_demo${target_suffix}.py.genexp |
There was a problem hiding this comment.
Out of curiosity what does genexp stands for here?
There was a problem hiding this comment.
that it'll be the input to the generate command in the following line to have its generator expressions (above) expanded
There was a problem hiding this comment.
ahhh thanks I couldnt figure out what genexp was suppose to abbreviate
| } | ||
| } | ||
|
|
||
| bool divides_into_twelve(size_t val, std::string logger_name) |
There was a problem hiding this comment.
does this mean that this returns that the value is a divider of 12 ?
(maybe that's my english + math vocabulary here but I had to check the code to see what divides_into_twelve mean). I would have expected this to return (val % 12) == 0 aka is_multiple_of_twelve
There was a problem hiding this comment.
yeah it means is_divisor_of_twelve, I'll update the name
| launch(name, [executable], output_file) | ||
|
|
||
|
|
||
| def launch(name, cmd, output_file, additional_processes=None): |
There was a problem hiding this comment.
this could default to [] and avoid adding the logic (additional_processes or []) below
There was a problem hiding this comment.
We try to avoid mutable defaults in general
There was a problem hiding this comment.
fair point, forgot about that 👍
|
|
||
| assert rc == 0, \ | ||
| "The launch file failed with exit code '" + str(rc) + "'. " \ | ||
| 'Maybe the client did not receive any messages?' |
There was a problem hiding this comment.
Not sure what the failure criteria is here but it looks like the assert message could use an update
| @@ -0,0 +1 @@ | |||
| \[DEBUG\] \[logger_usage_demo\]: Count divides into 12 \(function evaluated to true\) | |||
There was a problem hiding this comment.
Doest this need to be a regex? it seems like it could be a string to match like the file below
There was a problem hiding this comment.
if it's a txt it can't have any messages printed before this one gets matched or it fails
logging_demo/package.xml
Outdated
| @@ -0,0 +1,36 @@ | |||
| <?xml version="1.0"?> | |||
| <?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | |||
| <package format="2"> | |||
There was a problem hiding this comment.
Now that ros2/common_interfaces#45 and friends have been merged this should be updated to format3 and be declared as part of the rosidl_interface_packages group
This reverts commit 47305c0.
|
still looking for reviews on this if anyone has a chance, but it's lower priority overall since it's just a demo (the changes to the core required for this have been merged already) |
wjwwood
left a comment
There was a problem hiding this comment.
lgtm, though I think it might need some touch ups to compile again after ros2/rcutils#82
logging_demo/README.md
Outdated
| @@ -0,0 +1,75 @@ | |||
| # Logging and logger configuration | |||
|
|
|||
| See [the logging page]() for details on available functionality. | |||
There was a problem hiding this comment.
yeah I'll add it when I move it to the wiki 👍 sorry it wasn't clear that this is temporary.
logging_demo/logging_wiki.md
Outdated
|
|
||
| In C++: | ||
| ``` | ||
| rcutils_logging_set_logger_severity_threshold("logger_name", RCUTILS_LOG_SEVERITY_DEBUG); |
| } | ||
|
|
||
| // TODO(dhood): allow configuration through rclcpp | ||
| auto ret = rcutils_logging_set_logger_severity_threshold( |
| : Node("logger_config") | ||
| { | ||
| auto handle_logger_config_req = | ||
| [this]( |
There was a problem hiding this comment.
You only ever appear to use the get_name() of this, maybe just capture the name?
There was a problem hiding this comment.
Or make it a method like you did elsewhere in this pr.
|
@nuclearsandwich apologies for forgetting to tag you earlier but this ( |
|
@mikaelarguedas (build cop) I've seen the instability with connext and will fix |
|
btw the wiki page is at https://github.com/ros2/ros2/wiki/Logging-and-logger-configuration |
Usage:
The LoggerConfig component can be dropped into a running (composition-api-based) system to get config access to the loggers of the process