From: Prashant D Date: Wed, 18 Jan 2023 00:31:54 +0000 (-0500) Subject: common/LogEntry: Reintroduce human readable log level for clog messages X-Git-Tag: v20.0.0~2425^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=05d54ca52c07ca61f584de7b307af546135f8f4b;p=ceph.git common/LogEntry: Reintroduce human readable log level for clog messages In {fmt} v9, fmt::formatter<> is not getting defined automatically for the clog_type with operator<<, we need to define it explictly. Allow fmt::formatter<> to print clog prio using {fmt}. Fixes: https://tracker.ceph.com/issues/58436 Signed-off-by: Prashant D --- diff --git a/src/common/LogEntry.h b/src/common/LogEntry.h index 3ddebbd3043c..15d83fb956e6 100644 --- a/src/common/LogEntry.h +++ b/src/common/LogEntry.h @@ -194,6 +194,10 @@ inline std::ostream& operator<<(std::ostream& out, const LogEntry& e) << e.channel << " " << e.prio << " " << e.msg; } +#if FMT_VERSION >= 90000 +template <> struct fmt::formatter : fmt::ostream_formatter {}; +#endif + template <> struct fmt::formatter : fmt::formatter { template auto format(const EntityName& e, FormatContext& ctx) {