| 1078 | } } /* namespace debug */ |
| 1079 | |
| 1080 | DFhackCExport DFHack::command_result plugin_init(DFHack::color_ostream& out, |
| 1081 | std::vector<DFHack::PluginCommand>& commands) |
| 1082 | { |
| 1083 | commands.emplace_back( |
| 1084 | "debugfilter", |
| 1085 | "Manage runtime debug print filters", |
| 1086 | DFHack::debugPlugin::commandDebugFilter); |
| 1087 | auto& filMan = DFHack::debugPlugin::FilterManager::getInstance(); |
| 1088 | DFHack::command_result rv = DFHack::CR_OK; |
| 1089 | if ((rv = filMan.loadConfig(out)) != DFHack::CR_OK) |
| 1090 | return rv; |
| 1091 | auto& catMan = DFHack::DebugManager::getInstance(); |
| 1092 | std::lock_guard<std::mutex> lock(catMan.access_mutex_); |
| 1093 | for (auto* cat: catMan) { |
| 1094 | for (auto& filterPair: filMan) { |
| 1095 | DFHack::debugPlugin::Filter& filter = filterPair.second; |
| 1096 | filter.apply(*cat); |
| 1097 | } |
| 1098 | } |
| 1099 | INFO(init,out).print("plugin_init with {}, {} filters and {} categories\n", |
| 1100 | commands.size(), filMan.size(), catMan.size()); |
| 1101 | filMan.connectTo(catMan.categorySignal); |
| 1102 | return rv; |
| 1103 | } |
| 1104 | |
| 1105 | DFhackCExport DFHack::command_result plugin_shutdown(DFHack::color_ostream& out) |
| 1106 | { |
nothing calls this directly
no test coverage detected