Make {fmt} format the message type directly.
Change-Id: Id887079214992a346d13fcafbd048aa8af9d4457
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11768
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
#include "common/common.h"
#include "cpp-common/bt2c/call.hpp"
#include "common/common.h"
#include "cpp-common/bt2c/call.hpp"
+#include "cpp-common/bt2c/fmt.hpp"
#include "cpp-common/bt2s/make-unique.hpp"
#include "cpp-common/vendor/fmt/format.h"
#include "cpp-common/bt2s/make-unique.hpp"
#include "cpp-common/vendor/fmt/format.h"
-const char *msgTypeStr(const bt2::ConstMessage msg) noexcept
-{
- return bt_common_message_type_string(static_cast<bt_message_type>(msg.type()));
-}
-
std::string optLogStr(const char * const str) noexcept
{
return str ? fmt::format("\"{}\"", str) : "(none)";
std::string optLogStr(const char * const str) noexcept
{
return str ? fmt::format("\"{}\"", str) : "(none)";
- BT_CPPLOGD("Validating the clock class of a message: msg-type={}", msgTypeStr(msg));
+ BT_CPPLOGD("Validating the clock class of a message: msg-type={}", msg.type());
/* Get the clock class, if any, of `msg` */
const auto clkCls = bt2c::call([msg]() -> bt2::OptionalBorrowedObject<bt2::ConstClockClass> {
/* Get the clock class, if any, of `msg` */
const auto clkCls = bt2c::call([msg]() -> bt2::OptionalBorrowedObject<bt2::ConstClockClass> {
BT_CPPLOGT("Comparing two messages: "
"port-name-a={}, msg-a-type={}, msg-a-ts={}, "
"port-name-b={}, msg-b-type={}, msg-b-ts={}",
BT_CPPLOGT("Comparing two messages: "
"port-name-a={}, msg-a-type={}, msg-a-ts={}, "
"port-name-b={}, msg-b-type={}, msg-b-ts={}",
- upstreamMsgIterA->portName(), msgTypeStr(msgA), optMsgTsStr(msgTsA),
- upstreamMsgIterB->portName(), msgTypeStr(msgB), optMsgTsStr(msgTsB));
+ upstreamMsgIterA->portName(), msgA.type(), optMsgTsStr(msgTsA),
+ upstreamMsgIterB->portName(), msgB.type(), optMsgTsStr(msgTsB));