From 3383207ef5c9a021de4f90e9684b0f7ab88daf0b Mon Sep 17 00:00:00 2001 From: Bailey Chittle Date: Wed, 11 Jan 2023 15:49:34 -0500 Subject: [PATCH] default kv pairs --- include/spdlog/pattern_formatter-inl.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/spdlog/pattern_formatter-inl.h b/include/spdlog/pattern_formatter-inl.h index 30648276..cceef76d 100644 --- a/include/spdlog/pattern_formatter-inl.h +++ b/include/spdlog/pattern_formatter-inl.h @@ -1060,7 +1060,14 @@ public: fmt_helper::append_string_view(msg.payload, dest); if (msg.attributes.size() > 0) { + // by default uses logfmt-esque kv pairs fmt_helper::append_string_view(" | ", dest); // separate message from attributes + for (const details::attr& a : msg.attributes) { + details::fmt_helper::append_string_view(a.key, dest); + details::fmt_helper::append_string_view("=\"", dest); + details::fmt_helper::append_string_view(a.value, dest); + details::fmt_helper::append_string_view("\" ", dest); + } } }