| 1008 | } |
| 1009 | |
| 1010 | static command_result configureHeader(color_ostream& out, |
| 1011 | std::vector<std::string>& parameters) |
| 1012 | { |
| 1013 | DebugManager &dm = DebugManager::getInstance(); |
| 1014 | DebugManager::HeaderConfig config = dm.getHeaderConfig(); |
| 1015 | |
| 1016 | const size_t nparams = parameters.size(); |
| 1017 | if (nparams >= 2 && |
| 1018 | (parameters[1] == "enable" || parameters[1] == "disable")) { |
| 1019 | bool val = parameters[1] == "enable" ? true : false; |
| 1020 | for (size_t idx = 1; nparams > idx; ++idx) { |
| 1021 | const std::string ¶m = parameters[idx]; |
| 1022 | if (param == "timestamp") config.timestamp = val; |
| 1023 | else if (param == "timestamp_ms") config.timestamp_ms = val; |
| 1024 | else if (param == "thread_id") config.thread_id = val; |
| 1025 | else if (param == "plugin") config.plugin = val; |
| 1026 | else if (param == "category") config.category = val; |
| 1027 | } |
| 1028 | |
| 1029 | dm.setHeaderConfig(config); |
| 1030 | } |
| 1031 | |
| 1032 | out.color(COLOR_GREEN); |
| 1033 | out << std::setw(welement) << "Header element" |
| 1034 | << std::setw(wsetting) << "Setting" << '\n'; |
| 1035 | |
| 1036 | listHeaderSetting(out, COLOR_CYAN, "timestamp", config.timestamp); |
| 1037 | listHeaderSetting(out, COLOR_LIGHTCYAN, "timestamp_ms", |
| 1038 | config.timestamp_ms); |
| 1039 | listHeaderSetting(out, COLOR_CYAN, "thread_id", config.thread_id); |
| 1040 | listHeaderSetting(out, COLOR_LIGHTCYAN, "plugin", config.plugin); |
| 1041 | listHeaderSetting(out, COLOR_CYAN, "category", config.category); |
| 1042 | out << std::endl; |
| 1043 | |
| 1044 | INFO(example, out) << "Example message" << std::endl; |
| 1045 | |
| 1046 | return CR_OK; |
| 1047 | } |
| 1048 | |
| 1049 | using DFHack::debugPlugin::CommandDispatch; |
| 1050 |
nothing calls this directly
no test coverage detected