From: Kefu Chai Date: Fri, 23 Oct 2020 08:00:55 +0000 (+0800) Subject: mgr/DaemonHealthMetricCollector: replace boost::format with fmt::format X-Git-Tag: v16.1.0~771^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=85acc8bf1261289c4147a1ddd40a0d879fc8cb4e;p=ceph.git mgr/DaemonHealthMetricCollector: replace boost::format with fmt::format the latter is easier to use, and future proof in the sense that {fmt} was included as a part of C++20 standard Signed-off-by: Kefu Chai --- diff --git a/src/mgr/DaemonHealthMetricCollector.cc b/src/mgr/DaemonHealthMetricCollector.cc index 6467fed0497b..4b51100ee2e7 100644 --- a/src/mgr/DaemonHealthMetricCollector.cc +++ b/src/mgr/DaemonHealthMetricCollector.cc @@ -1,4 +1,4 @@ -#include +#include #include "include/health.h" #include "include/types.h" @@ -30,7 +30,6 @@ class SlowOps final : public DaemonHealthMetricCollector { if (daemons.empty()) { return; } - static const char* fmt = "%1% slow ops, oldest one blocked for %2% sec, %3%"; ostringstream ss; if (daemons.size() > 1) { if (daemons.size() > 10) { @@ -42,7 +41,9 @@ class SlowOps final : public DaemonHealthMetricCollector { } else { ss << daemons.front() << " has slow ops"; } - check.summary = boost::str(boost::format(fmt) % value.n1 % value.n2 % ss.str()); + check.summary = + fmt::format("{} slow ops, oldest one blocked for {} sec, {}", + value.n1, value.n2, ss.str()); // No detail } vector daemons; @@ -70,8 +71,7 @@ class PendingPGs final : public DaemonHealthMetricCollector { if (osds.empty()) { return; } - static const char* fmt = "%1% PGs pending on creation"; - check.summary = boost::str(boost::format(fmt) % value.n); + check.summary = fmt::format("{} PGs pending on creation", value.n); ostringstream ss; if (osds.size() > 1) { ss << "osds " << osds << " have pending PGs.";