3 #include <glog/logging.h> 17 google::InitGoogleLogging(
"rosconsole");
20 std::string
getName(
void* handle);
28 if(rosconsole_glog_appender)
30 rosconsole_glog_appender->
log(level, str, file,
function, line);
33 google::LogSeverity glog_level;
36 glog_level = google::GLOG_INFO;
40 glog_level = google::GLOG_WARNING;
44 glog_level = google::GLOG_ERROR;
48 glog_level = google::GLOG_FATAL;
55 std::string name =
getName(handle);
56 google::LogMessage(file, line, glog_level).stream() << name <<
": " << str;
61 size_t index = (size_t)handle;
62 if(index < rosconsole_glog_log_levels.size())
64 return level >= rosconsole_glog_log_levels[index].second;
71 size_t count = rosconsole_glog_log_levels.size();
72 for(
size_t index = 0; index < count; index++)
74 if(name == rosconsole_glog_log_levels[index].first)
82 return (
void*)(rosconsole_glog_log_levels.size() - 1);
87 size_t index = (size_t)handle;
88 if(index < rosconsole_glog_log_levels.size())
90 return rosconsole_glog_log_levels[index].first;
97 rosconsole_glog_appender = appender;
105 for(std::vector<std::pair<std::string, levels::Level> >::const_iterator it = rosconsole_glog_log_levels.begin(); it != rosconsole_glog_log_levels.end(); it++)
107 loggers[it->first] = it->second;
114 for(std::vector<std::pair<std::string, levels::Level> >::iterator it = rosconsole_glog_log_levels.begin(); it != rosconsole_glog_log_levels.end(); it++)
116 if(name == it->first)
void print(void *handle,::ros::console::Level level, const char *str, const char *file, const char *function, int line)
std::string getName(void *handle)
void register_appender(LogAppender *appender)
bool get_loggers(std::map< std::string, levels::Level > &loggers)
bool set_logger_level(const std::string &name, levels::Level level)
bool isEnabledFor(void *handle,::ros::console::Level level)
std::vector< std::pair< std::string, levels::Level > > rosconsole_glog_log_levels
void * getHandle(const std::string &name)
void print(ros::console::Level level, const std::string &s)
LogAppender * rosconsole_glog_appender
virtual void log(::ros::console::Level level, const char *str, const char *file, const char *function, int line)=0