2 #define ROSCONSOLE_CONSOLE_IMPL_EXPORTS 5 #include <glog/logging.h> 19 google::InitGoogleLogging(
"rosconsole");
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)
81 return (
void*)(rosconsole_glog_log_levels.size() - 1);
86 size_t index = (size_t)handle;
87 if(index < rosconsole_glog_log_levels.size())
89 return rosconsole_glog_log_levels[index].first;
96 rosconsole_glog_appender = appender;
101 if(rosconsole_glog_appender == appender)
103 rosconsole_glog_appender = 0;
112 for(std::vector<std::pair<std::string, levels::Level> >::const_iterator it = rosconsole_glog_log_levels.begin(); it != rosconsole_glog_log_levels.end(); it++)
114 loggers[it->first] = it->second;
121 for(std::vector<std::pair<std::string, levels::Level> >::iterator it = rosconsole_glog_log_levels.begin(); it != rosconsole_glog_log_levels.end(); it++)
123 if(name == it->first)
ROSCONSOLE_CONSOLE_IMPL_DECL void print(void *handle, ::ros::console::Level level, const char *str, const char *file, const char *function, int line)
ROSCONSOLE_CONSOLE_IMPL_DECL void shutdown()
ROSCONSOLE_CONSOLE_IMPL_DECL std::string getName(void *handle)
ROSCONSOLE_CONSOLE_IMPL_DECL void register_appender(LogAppender *appender)
ROSCONSOLE_CONSOLE_IMPL_DECL void initialize()
ROSCONSOLE_CONSOLE_IMPL_DECL bool get_loggers(std::map< std::string, levels::Level > &loggers)
ROSCONSOLE_CONSOLE_IMPL_DECL bool set_logger_level(const std::string &name, levels::Level level)
ROSCONSOLE_CONSOLE_IMPL_DECL bool isEnabledFor(void *handle, ::ros::console::Level level)
ROSCONSOLE_CONSOLE_IMPL_DECL void deregister_appender(LogAppender *appender)
std::vector< std::pair< std::string, levels::Level > > rosconsole_glog_log_levels
ROSCONSOLE_CONSOLE_IMPL_DECL 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