TEST(SimpleConfigTest, test_get_config_map) { std::string conf = "./conf/simple_log.conf"; std::map<std::string, std::string> configs; int ret = get_config_map(conf.c_str(), configs); ASSERT_EQ(0, ret); ASSERT_EQ(3, (int)configs.size()); }
int LogMonitorHandler::load_configs(char *config_file) { get_config_map(config_file, configs); if (configs[LINE_REG_NAME].empty()) { LOG_ERROR("log_reg is empty!"); return -1; } if (configs[TIME_FORMAT_NAME].empty()) { LOG_ERROR("time_format is empty!"); return -1; } return 0; }