Trigger code segments for ROS_DEBUG only
I'm wondering if there's a way to do the following in C++:
if(<my logger level is set to ROS_DEBUG>)
{
//execute a costly code block that I don't want to do for the sake of efficiency
//unless my logger level is set to ROS_DEBUG.
ROS_DEBUG_STREAM("Some output based on the computation");
}
I need to do some computation to get useful output in DEBUG mode, but I don't want to do that computation in normal operation.