Retrieve loglevel of current node using rospy
Sometimes generating certain debug information may be computationally burdensome and therefore it may be desirable to make this dependent on the current log level.
Thus I was wondering, what would be the correct way to retrieve the loglevel from within a node using rospy (in Kinetic)? Ultimately, I would want to be able to do something like this:
if current_log_level == rospy.DEBUG:
result = burdensome_stats_generation()
rospy.logdebug("Very informative output: %s", res)