]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/LogEntry: Reintroduce human readable log level for clog messages
authorPrashant D <pdhange@redhat.com>
Wed, 18 Jan 2023 00:31:54 +0000 (19:31 -0500)
committerPrashant D <pdhange@redhat.com>
Wed, 7 Feb 2024 20:23:02 +0000 (15:23 -0500)
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 <pdhange@redhat.com>
src/common/LogEntry.h

index 3ddebbd3043c062eff3b4df7b7c3a3caa8748bc7..15d83fb956e6bd7faf0c693e41f00e91e7b239d1 100644 (file)
@@ -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<clog_type> : fmt::ostream_formatter {};
+#endif
+
 template <> struct fmt::formatter<EntityName> : fmt::formatter<std::string_view> {
   template <typename FormatContext>
   auto format(const EntityName& e, FormatContext& ctx) {