client/Response: add method Fmt() based on libfmt
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "Partition.hxx"
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <set>
|
||||
#include <string>
|
||||
@@ -85,7 +87,7 @@ handle_channels(Client &client, [[maybe_unused]] Request args, Response &r)
|
||||
}
|
||||
|
||||
for (const auto &channel : channels)
|
||||
r.Format("channel: %s\n", channel.c_str());
|
||||
r.Fmt(FMT_STRING("channel: {}\n"), channel);
|
||||
|
||||
return CommandResult::OK;
|
||||
}
|
||||
@@ -97,8 +99,8 @@ handle_read_messages(Client &client,
|
||||
assert(args.empty());
|
||||
|
||||
client.ConsumeMessages([&r](const auto &msg){
|
||||
r.Format("channel: %s\nmessage: %s\n",
|
||||
msg.GetChannel(), msg.GetMessage());
|
||||
r.Fmt(FMT_STRING("channel: {}\nmessage: {}\n"),
|
||||
msg.GetChannel(), msg.GetMessage());
|
||||
});
|
||||
|
||||
return CommandResult::OK;
|
||||
|
||||
Reference in New Issue
Block a user