| 224 | struct GetLogCmd { |
| 225 | static const char* name; |
| 226 | static Future<Reference<ExtMsgReply>> call(Reference<ExtConnection> nmc, |
| 227 | Reference<ExtMsgQuery> query, |
| 228 | Reference<ExtMsgReply> reply) { |
| 229 | bson::BSONObjBuilder bob; |
| 230 | |
| 231 | if (query->ns.first != "admin") { |
| 232 | // clang-format off |
| 233 | reply->addDocument((bob << "ok" << 0.0 << |
| 234 | "errmsg" << "access denied; use admin db" << |
| 235 | "$err" << "access denied; use admin db").obj()); |
| 236 | // clang-format on |
| 237 | return reply; |
| 238 | } |
| 239 | |
| 240 | std::string log = query->query["getLog"].String(); |
| 241 | |
| 242 | if (log == "*") { |
| 243 | reply->addDocument(BSON("names" << BSON_ARRAY("global" |
| 244 | << "startupWarnings") |
| 245 | << "ok" << 1)); |
| 246 | } else if (log == "startupWarnings") { |
| 247 | reply->addDocument(BSON("totalLinesWritten" << 3 << "log" |
| 248 | << BSON_ARRAY("" |
| 249 | << "WARNING: This is not really mongodb." |
| 250 | << "") |
| 251 | << "ok" << 1)); |
| 252 | } else if (log == "global") { |
| 253 | reply->addDocument(BSON("totalLinesWritten" << 1 << "log" << BSON_ARRAY("foo") << "ok" << 1.0)); |
| 254 | } |
| 255 | |
| 256 | return reply; |
| 257 | } |
| 258 | }; |
| 259 | REGISTER_CMD(GetLogCmd, "getlog"); |
| 260 |
nothing calls this directly
no test coverage detected