void ConfigManager::setConfig (const ICommand::Args& args) { if (args.size() != 2) { Log::error(LOG_CONFIG, "parameters: the config key"); return; } Log::info(LOG_CONFIG, "set %s to %s", args[0].c_str(), args[1].c_str()); ConfigVarPtr p = getConfigVar(args[0]); p->setValue(args[1]); }
void ConfigManager::setLogLevel (const ICommand::Args& args) { if (args.size() != 1) return; const int max = static_cast<int>(LogLevel::LEVEL_MAX); for (int i = 0; i < max; ++i) { if (args[0] == LogLevels[i].logLevelStr) { Log::info(LOG_CONFIG, "Changing log level to %s", args[0].c_str()); _logLevel = LogLevels[i].logLevel; return; } } Log::error(LOG_CONFIG, "Failed to change the level to %s", args[0].c_str()); }
void ConfigManager::setLogLevel (const ICommand::Args& args) { if (args.size() != 1) return; const int max = static_cast<int>(LogLevel::LEVEL_MAX); for (int i = 0; i < max; ++i) { if (args[0] == LogLevels[i].logLevelStr) { SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, LogLevels[i].sdlLevel); _logLevel = LogLevels[i].logLevel; Log::info(LOG_COMMON, "Changing log level to %s", args[0].c_str()); return; } } Log::error(LOG_COMMON, "Failed to change the level to %s", args[0].c_str()); }