From 4f235e19cc13132009f5eda3150ee4d46b467bbb Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 26 Mar 2024 21:35:59 +0000 Subject: [PATCH] Fix: cpp-common/bt2c/logging.hpp: don't set `_mSelfComp` when creating `Logger` for message iterator Only one context in `Logger` must be set. Similarly, when creating a `Logger` for a component, we don't set `_mSelfCompCls`. Change-Id: Ie826986d301cb996b594127c72094b90974b8e87 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/12197 Tested-by: jenkins Reviewed-by: Philippe Proulx --- src/cpp-common/bt2c/logging.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpp-common/bt2c/logging.hpp b/src/cpp-common/bt2c/logging.hpp index 159e909b..c732ef4c 100644 --- a/src/cpp-common/bt2c/logging.hpp +++ b/src/cpp-common/bt2c/logging.hpp @@ -115,9 +115,9 @@ public: * using the tag `tag`. */ explicit Logger(const bt2::SelfMessageIterator selfMsgIter, std::string tag) noexcept : - Logger {selfMsgIter.component(), std::move(tag)} + _mSelfMsgIter {selfMsgIter}, + _mLevel {static_cast(selfMsgIter.component().loggingLevel())}, _mTag {std::move(tag)} { - _mSelfMsgIter = selfMsgIter; } /* @@ -580,7 +580,7 @@ private: return fmt::format("{}: {}", initMsg, g_strerror(errno)); } - /* At least one of the following four members has a value */ + /* Exactly one of the following four members has a value */ bt2s::optional _mSelfCompCls; bt2s::optional _mSelfComp; bt2s::optional _mSelfMsgIter; -- 2.34.1