20 #include <qicore/logmessage.hpp> 23 #include <std_msgs/String.h> 25 #include <boost/algorithm/string.hpp> 26 #include <boost/thread/mutex.hpp> 27 #include <boost/foreach.hpp> 31 #define for_each BOOST_FOREACH 41 std::queue<rosgraph_msgs::Log>
LOGS;
49 all_.push_back(*
this);
55 if (log_level.
qi_ == qi)
78 static std::vector<LogLevel>
all_;
88 rosgraph_msgs::Log
log;
90 std::vector<std::string> results;
91 boost::split(results, msg.source, boost::is_any_of(
":"));
92 log.file = results[0];
93 log.function = results[1];
94 log.line = atoi(results[2].c_str());
96 log.name = msg.category;
97 log.msg = msg.message;
98 log.header.stamp =
ros::Time(msg.timestamp.tv_sec, msg.timestamp.tv_usec);
102 boost::mutex::scoped_lock lock( MUTEX_LOGS );
103 while (LOGS.size() > 1000)
112 logger_( session->service(
"LogManager") ),
114 log_level_(qi::LogLevel_Info)
137 while ( !LOGS.empty() )
139 rosgraph_msgs::Log& log_msg = LOGS.front();
145 boost::mutex::scoped_lock lock( MUTEX_LOGS );
159 std::map<std::string, ros::console::levels::Level> loggers;
162 std::map<std::string, ros::console::levels::Level>::iterator iter = loggers.find(
"ros.naoqi_driver");
164 if (iter == loggers.end())
void set_qi_logger_level()
INLINE Rall1d< T, V, S > log(const Rall1d< T, V, S > &arg)
void callAll(const std::vector< message_actions::MessageAction > &actions)
boost::function< void(rosgraph_msgs::Log &) > Callback_t
ROSCONSOLE_DECL bool get_loggers(std::map< std::string, levels::Level > &loggers)
void logCallback(const qi::LogMessage &msg)
static const LogLevel & get_from_ros_console(ros::console::levels::Level ros_console)
std::map< message_actions::MessageAction, Callback_t > callbacks_
LogConverter(const std::string &name, float frequency, const qi::SessionPtr &sessions)
static const LogLevel & get_from_ros_msg(rosgraph_msgs::Log::_level_type ros_msg)
void registerCallback(const message_actions::MessageAction action, Callback_t cb)
rosgraph_msgs::Log::_level_type ros_msg_
std::queue< rosgraph_msgs::Log > LOGS
qi::LogManagerPtr logger_
LogLevel(qi::LogLevel qi, rosgraph_msgs::Log::_level_type ros_msg, ros::console::levels::Level ros_console)
static const LogLevel & get_from_qi(qi::LogLevel qi)
qi::LogListenerPtr listener_
static std::vector< LogLevel > all_
ros::console::levels::Level ros_console_