cpp-common/bt2c: Logger: add self component class constructor
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 27 Sep 2024 20:01:20 +0000 (16:01 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 9 Oct 2024 02:56:57 +0000 (22:56 -0400)
Make it possible to build a `Logger` from a self component class only
(for instance, from the "get supported mip versions" method).

Change-Id: Ic1d0abe8832eb5af831d5fa2b66b3d9737bcdee7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13294
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/cpp-common/bt2c/logging.hpp

index 347063ab20089e4c063b2fceb3a98e00f5f34787..1d2285a06061adeb4d06540c677928577a95e137 100644 (file)
@@ -86,6 +86,17 @@ public:
 
     /* clang-format on */
 
+    /*
+     * Builds a logger from the self component class `selfCompCls` using
+     * the tag `tag` and the logging level `logLevel`.
+     */
+    explicit Logger(const bt2::SelfComponentClass selfCompCls, const bt2::LoggingLevel logLevel,
+                    std::string tag) noexcept :
+        _mSelfCompCls {selfCompCls},
+        _mLevel {static_cast<Level>(logLevel)}, _mTag {std::move(tag)}
+    {
+    }
+
     /*
      * Builds a logger from the self component class `selfCompCls` using
      * the tag `tag` and the logging level of `privQueryExec`.
This page took 0.026667 seconds and 4 git commands to generate.