38 #include <console_bridge/console.h> 
   48 void OutputHandlerROS::log(
const std::string &text, console_bridge::LogLevel level, 
const char *filename, 
int line)
 
   54   static const std::string NEEDLE_STRING = 
": ";
 
   55   size_t sub_index = text.find(NEEDLE_STRING);
 
   56   size_t space_index = text.find(
" ");
 
   58   if (sub_index != std::string::npos && 
 
   60       space_index > sub_index && 
 
   61       text.length() > space_index + 1) 
 
   63     prefix = std::string(ROSCONSOLE_NAME_PREFIX) + 
"." + text.substr(0, sub_index);
 
   65     sub_index += NEEDLE_STRING.length();
 
   69     prefix = std::string(ROSCONSOLE_NAME_PREFIX) + 
".console_bridge";
 
   76   case console_bridge::CONSOLE_BRIDGE_LOG_INFO:
 
   81         ::ros::console::print(NULL, __rosconsole_define_location__loc.logger_, __rosconsole_define_location__loc.level_, filename, line, 
"", 
"%s",
 
   82           text.substr(sub_index, std::string::npos).c_str());
 
   86   case console_bridge::CONSOLE_BRIDGE_LOG_WARN:
 
   91         ::ros::console::print(NULL, __rosconsole_define_location__loc.logger_, __rosconsole_define_location__loc.level_, filename, line, 
"", 
"%s",
 
   92           text.substr(sub_index, std::string::npos).c_str());
 
   96   case console_bridge::CONSOLE_BRIDGE_LOG_ERROR:
 
  101         ::ros::console::print(NULL, __rosconsole_define_location__loc.logger_, __rosconsole_define_location__loc.level_, filename, line, 
"", 
"%s",
 
  102           text.substr(sub_index, std::string::npos).c_str());
 
  110       if (
ROS_UNLIKELY(__rosconsole_define_location__enabled))
 
  112         ::ros::console::print(NULL, __rosconsole_define_location__loc.logger_, __rosconsole_define_location__loc.level_, filename, line, 
"", 
"%s",
 
  113           text.substr(sub_index, std::string::npos).c_str());
 
  120 RegisterOutputHandlerProxy::RegisterOutputHandlerProxy(
void)
 
  122   static OutputHandlerROS oh_ros;
 
  123   console_bridge::useOutputHandler(&oh_ros);
 
  126   console_bridge::setLogLevel(console_bridge::CONSOLE_BRIDGE_LOG_DEBUG);
 
  129 RegisterOutputHandlerProxy::~RegisterOutputHandlerProxy()
 
  131   console_bridge::restorePreviousOutputHandler();