[ros-users] Retrieving log level at runtime

Blaise Gassend blaise at willowgarage.com
Wed Oct 13 16:03:28 UTC 2010


Hi Stephane,

This isn't directly an answer to your question, but have you
considered packaging your std::ostringstream work into a function? If
you do

ROS_DEBUG("My aseba message: %s", aseba_to_str(my_aseba));

then aseba_to_str() will only get called when the logging level is set to debug.

Blaise

2010/10/13 Stéphane Magnenat <stephane.magnenat at mavt.ethz.ch>:
> Hello,
>
> I would like to retrieve the log level at runtime. I want to do so
> because I have (aseba) messages that I have to dump into a
> std::ostringstream prior to print their content on a ROS_DEBUG_STREAM.
> Of course, I would like to perform this dump operation only if the
> logging level is currently debug. Is there a public API to do so? If
> not, what is the internal variable to check, and how stable will it be?
> I did not find the answer to this question in the rosconsole
> documentation nor in the mailing list archive.
>
> Thank you, best regards,
>
> Stéphane
>
> --
> Dr Stéphane Magnenat
> http://stephane.magnenat.net
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



More information about the ros-users mailing list