MCPcopy Create free account
hub / github.com/apple/foundationdb / printJSON

Method printJSON

flow/CodeProbe.cpp:177–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175 }
176
177 void printJSON(std::vector<std::string> const& context = std::vector<std::string>()) const {
178 verify();
179 do {
180 struct foo {};
181 foo f;
182 fmt::print("{}\n", boost::core::demangle(typeid(f).name()));
183 } while (false);
184 do {
185 struct foo {};
186 foo f;
187 fmt::print("{}\n", boost::core::demangle(typeid(f).name()));
188 } while (false);
189 auto contexts = fromStrings(context);
190 const ICodeProbe* prev = nullptr;
191 for (auto probe : codeProbes) {
192 auto p = probe.second;
193 if (!contexts.empty()) {
194 bool print = false;
195 for (auto c : contexts) {
196 print = print || p->expectInContext(c);
197 }
198 if (!print) {
199 continue;
200 }
201 }
202 if (prev == nullptr || *prev != *probe.second) {
203 fmt::print(
204 "{{ \"File\": \"{}\", \"Line\": {}, \"Comment\": \"{}\", \"Condition\": \"{}\", \"Function\": "
205 "\"{}\" }}\n",
206 probe.first.file,
207 p->line(),
208 p->comment(),
209 p->condition(),
210 p->function());
211 }
212 prev = probe.second;
213 }
214 }
215};
216
217size_t hash_value(CodeProbes::Location const& location) {

Callers 1

printProbesJSONMethod · 0.80

Calls 9

fromStringsFunction · 0.85
expectInContextMethod · 0.80
lineMethod · 0.80
commentMethod · 0.80
conditionMethod · 0.80
functionMethod · 0.80
nameMethod · 0.65
printFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected