summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReo Kimura <reo.kimura@mongodb.com>2020-06-29 23:54:36 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-09 17:14:19 +0000
commite0ec3c2c1be2bd0d3263d059610579dfc94bfa7d (patch)
treef072d8f583470f676ede302b54f0ac0152ab2171
parentc3998c148074d9b31bf2d6e4ad3910756b394e9f (diff)
downloadmongo-e0ec3c2c1be2bd0d3263d059610579dfc94bfa7d.tar.gz
SERVER-48205 Rewrote toString() functions using fmtlib, locally untested
-rw-r--r--src/mongo/executor/remote_command_response.cpp31
-rw-r--r--src/mongo/executor/remote_command_response.h1
2 files changed, 21 insertions, 11 deletions
diff --git a/src/mongo/executor/remote_command_response.cpp b/src/mongo/executor/remote_command_response.cpp
index 146a3abc70d..f0311b2ce4e 100644
--- a/src/mongo/executor/remote_command_response.cpp
+++ b/src/mongo/executor/remote_command_response.cpp
@@ -76,11 +76,15 @@ bool RemoteCommandResponseBase::isOK() const {
}
std::string RemoteCommandResponse::toString() const {
- return str::stream() << "RemoteResponse -- "
- << " cmd:" << data.toString() << " status: " << status.toString()
- << " elapsedMillis: "
- << (elapsedMillis != boost::none ? elapsedMillis.get().toString() : "n/a")
- << " moreToCome: " << moreToCome;
+ return format(FMT_STRING("RemoteResponse --"
+ " cmd: {}"
+ " status: {}"
+ " elapsedMillis: {}"
+ " moreToCome: {}"),
+ data.toString(),
+ status.toString(),
+ elapsedMillis ? StringData(elapsedMillis->toString()) : "n/a"_sd,
+ moreToCome);
}
bool RemoteCommandResponse::operator==(const RemoteCommandResponse& rhs) const {
@@ -149,12 +153,17 @@ bool RemoteCommandOnAnyResponse::operator!=(const RemoteCommandOnAnyResponse& rh
}
std::string RemoteCommandOnAnyResponse::toString() const {
- return str::stream() << "RemoteOnAnyResponse -- "
- << " cmd:" << data.toString() << " target: "
- << (!target ? StringData("[none]") : StringData(target->toString()))
- << " status: " << status.toString() << " elapsedMillis: "
- << (elapsedMillis != boost::none ? elapsedMillis.get().toString() : "n/a")
- << " moreToCome: " << moreToCome;
+ return format(FMT_STRING("RemoteOnAnyResponse -- "
+ " cmd: {}"
+ " target: {}"
+ " status: {}"
+ " elapsedMillis: {}"
+ " moreToCome: {}"),
+ data.toString(),
+ target ? StringData(target->toString()) : "[none]"_sd,
+ status.toString(),
+ elapsedMillis ? StringData(elapsedMillis.get().toString()) : "n/a"_sd,
+ moreToCome);
}
std::ostream& operator<<(std::ostream& os, const RemoteCommandOnAnyResponse& response) {
diff --git a/src/mongo/executor/remote_command_response.h b/src/mongo/executor/remote_command_response.h
index 7842ebdfe14..a49b3deb763 100644
--- a/src/mongo/executor/remote_command_response.h
+++ b/src/mongo/executor/remote_command_response.h
@@ -30,6 +30,7 @@
#pragma once
#include <boost/optional.hpp>
+#include <fmt/format.h>
#include <iosfwd>
#include <memory>
#include <string>