Fix: cpp-common/bt2c/logging.hpp: don't set `_mSelfComp` when creating `Logger` for...
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 26 Mar 2024 21:35:59 +0000 (21:35 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 28 Mar 2024 17:52:05 +0000 (13:52 -0400)
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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12197
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/cpp-common/bt2c/logging.hpp

index 159e909bb66e48150f57e4b9e1da48808f6616e8..c732ef4ca5bb7402ef0e81f0e63674e60c8dbc5c 100644 (file)
@@ -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<Level>(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<bt2::SelfComponentClass> _mSelfCompCls;
     bt2s::optional<bt2::SelfComponent> _mSelfComp;
     bt2s::optional<bt2::SelfMessageIterator> _mSelfMsgIter;
This page took 0.026443 seconds and 4 git commands to generate.