Skip to content

Instantly share code, notes, and snippets.

@OkkeHendriks
Created January 29, 2015 10:45
Show Gist options
  • Save OkkeHendriks/4f4adfeafb71875ed75b to your computer and use it in GitHub Desktop.
Save OkkeHendriks/4f4adfeafb71875ed75b to your computer and use it in GitHub Desktop.
Is this correct behavior or not? I want to be able to control the logger levels of the separate instances of TestClass, thus they need differing names.
#include <ros/ros.h>
class TestClass
{
public:
TestClass(const std::string name)
{
ROS_INFO_NAMED(name, "This name should be: %s? The same as the logger name in front << ? ", name.c_str());
}
~TestClass(){};
};
int main(int argc, char *argv[])
{
ros::init(argc, argv, "Node_Name");
ros::NodeHandle n;
TestClass test1("name1");
TestClass test2("name2");
TestClass test3("name3");
}
// Output:
$ rosrun rose20_common logger_test
1422528278.730831613|ros.rose20_common.name1[ INFO]: This name should be: name1? The same as the logger name in front << ?
1422528278.730899707|ros.rose20_common.name1[ INFO]: This name should be: name2? The same as the logger name in front << ?
1422528278.730919307|ros.rose20_common.name1[ INFO]: This name should be: name3? The same as the logger name in front << ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment