cpp-common/bt2c/logging.hpp: remove no-formatting ("str") alternatives
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 25 Apr 2024 04:05:09 +0000 (00:05 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 25 Apr 2024 13:21:01 +0000 (09:21 -0400)
This patch removes everything named bt2c::Logger::log*Str*() and
BT_CPPLOG*STR*().

The no-formatting versions existed to avoid a call to fmt::format_to()
when you need to log a literal string as is, without any formatting. It
was also useful to pass a user string as is.

However, in the end, I don't think such an optimization is necessary:

• We don't use the no-formatting versions that much compared to messages
  with a format string.

• fmt::format_to() is pretty fast without any replacement field.

• We're talking about logging performance.

• This patch removes a lot of often redudant code from `logging.hpp`.

Adapt the current no-formatting logging calls accordingly.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ie02ea492e220c7ce9b72aaf8728fb7d2211e0bc0
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12479
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
17 files changed:
src/cpp-common/bt2c/logging.hpp
src/plugins/ctf/common/src/bfcr/bfcr.cpp
src/plugins/ctf/common/src/metadata/tsdl/ctf-meta-resolve.cpp
src/plugins/ctf/common/src/metadata/tsdl/decoder-packetized-file-stream-to-buf.cpp
src/plugins/ctf/common/src/metadata/tsdl/lexer.lpp
src/plugins/ctf/common/src/metadata/tsdl/objstack.cpp
src/plugins/ctf/common/src/metadata/tsdl/parser.ypp
src/plugins/ctf/common/src/metadata/tsdl/visitor-generate-ir.cpp
src/plugins/ctf/common/src/msg-iter/msg-iter.cpp
src/plugins/ctf/fs-sink/fs-sink-trace.cpp
src/plugins/ctf/fs-sink/fs-sink.cpp
src/plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.cpp
src/plugins/ctf/fs-src/data-stream-file.cpp
src/plugins/ctf/fs-src/fs.cpp
src/plugins/ctf/lttng-live/lttng-live.cpp
src/plugins/utils/muxer/comp.cpp
src/plugins/utils/muxer/msg-iter.cpp

index 90db909b3003aa58a6b3dad6d2d0582ceb2663d5..970ff9b77d85a8782e147b0a6884422995e9d981 100644 (file)
@@ -291,19 +291,6 @@ public:
                                                         std::forward<ArgTs>(args)...);
     }
 
-    /*
-     * Logs `msg` using the level `LevelV`.
-     *
-     * If `AppendCauseV` is true, this method also appends a cause to
-     * the error of the current thread using the same message.
-     */
-    template <Level LevelV, bool AppendCauseV>
-    void logStr(const char * const fileName, const char * const funcName, const unsigned int lineNo,
-                const char * const msg) const
-    {
-        this->_logStr<_StdLogWriter, LevelV, AppendCauseV>(fileName, funcName, lineNo, {}, "", msg);
-    }
-
     /*
      * Like log() with the `Level::Error` level, but also throws a
      * default-constructed instance of `ExcT`.
@@ -318,18 +305,6 @@ public:
         throw ExcT {};
     }
 
-    /*
-     * Like logStr() with the `Level::Error` level, but also throws a
-     * default-constructed instance of `ExcT`.
-     */
-    template <bool AppendCauseV, typename ExcT>
-    [[noreturn]] void logErrorStrAndThrow(const char * const fileName, const char * const funcName,
-                                          const unsigned int lineNo, const char * const msg) const
-    {
-        this->logStr<Level::Error, AppendCauseV>(fileName, funcName, lineNo, msg);
-        throw ExcT {};
-    }
-
     /*
      * Like log() with the `Level::Error` level, but also rethrows.
      */
@@ -343,18 +318,6 @@ public:
         throw;
     }
 
-    /*
-     * Like logStr() with the `Level::Error` level, but also rethrows.
-     */
-    template <bool AppendCauseV>
-    [[noreturn]] void logErrorStrAndRethrow(const char * const fileName,
-                                            const char * const funcName, const unsigned int lineNo,
-                                            const char * const msg) const
-    {
-        this->logStr<Level::Error, AppendCauseV>(fileName, funcName, lineNo, msg);
-        throw;
-    }
-
 private:
     struct _InitMsgLogWriter final
     {
@@ -388,24 +351,6 @@ public:
                                                             fmt, std::forward<ArgTs>(args)...);
     }
 
-    /*
-     * Logs the message of `errno` using the level `LevelV`.
-     *
-     * The log message starts with `initMsg`, is followed with the
-     * message for `errno`, and then with `msg`.
-     *
-     * If `AppendCauseV` is true, this method also appends a cause to
-     * the error of the current thread using the same message.
-     */
-    template <Level LevelV, bool AppendCauseV>
-    void logErrnoStr(const char * const fileName, const char * const funcName,
-                     const unsigned int lineNo, const char * const initMsg,
-                     const char * const msg) const
-    {
-        this->_logStr<_InitMsgLogWriter, LevelV, AppendCauseV>(
-            fileName, funcName, lineNo, {}, this->_errnoIntroStr(initMsg).c_str(), msg);
-    }
-
     /*
      * Like logErrno() with the `Level::Error` level, but also throws a
      * default-constructed instance of `ExcT`.
@@ -421,20 +366,6 @@ public:
         throw ExcT {};
     }
 
-    /*
-     * Like logErrnoStr() with the `Level::Error` level, but also throws
-     * a default-constructed instance of `ExcT`.
-     */
-    template <bool AppendCauseV, typename ExcT>
-    [[noreturn]] void
-    logErrorErrnoStrAndThrow(const char * const fileName, const char * const funcName,
-                             const unsigned int lineNo, const char * const initMsg,
-                             const char * const msg) const
-    {
-        this->logErrnoStr<Level::Error, AppendCauseV>(fileName, funcName, lineNo, initMsg, msg);
-        throw ExcT {};
-    }
-
     /*
      * Like logErrno() with the `Level::Error` level, but also rethrows.
      */
@@ -449,20 +380,6 @@ public:
         throw;
     }
 
-    /*
-     * Like logErrnoStr() with the `Level::Error` level, but also
-     * rethrows.
-     */
-    template <bool AppendCauseV>
-    [[noreturn]] void
-    logErrorErrnoStrAndRethrow(const char * const fileName, const char * const funcName,
-                               const unsigned int lineNo, const char * const initMsg,
-                               const char * const msg) const
-    {
-        this->logErrnoStr<Level::Error, AppendCauseV>(fileName, funcName, lineNo, initMsg, msg);
-        throw;
-    }
-
 private:
     struct _MemLogWriter final
     {
@@ -490,80 +407,61 @@ public:
                                                  std::forward<ArgTs>(args)...);
     }
 
-    /*
-     * Logs memory data using the level `LevelV`, starting with the
-     * message `msg`.
-     */
-    template <Level LevelV>
-    void logMemStr(const char * const fileName, const char * const funcName,
-                   const unsigned int lineNo, const MemData memData, const char * const msg) const
-    {
-        this->_logStr<_MemLogWriter, LevelV, false>(fileName, funcName, lineNo, memData, "", msg);
-    }
-
 private:
     /*
      * Formats a log message with fmt::format() given `fmt` and `args`,
-     * and then forwards everything to _logStr().
+     * and then:
+     *
+     * 1. Calls LogWriterT::write() with its arguments to log using the
+     *    level `LevelV`.
+     *
+     * 2. If `AppendCauseV` is true, this method also appends a cause to
+     *    the error of the current thread using the concatenation of
+     *    `initMsg` and `msg` as the message.
      */
     template <typename LogWriterT, Level LevelV, bool AppendCauseV, typename... ArgTs>
     void _log(const char * const fileName, const char * const funcName, const unsigned int lineNo,
               const MemData memData, const char * const initMsg, const char * const fmt,
               ArgTs&&...args) const
     {
+        const auto wouldLog = this->wouldLog(LevelV);
+
         /* Only format arguments if logging or appending an error cause */
-        if (G_UNLIKELY(this->wouldLog(LevelV) || AppendCauseV)) {
+        if (G_UNLIKELY(wouldLog || AppendCauseV)) {
             /*
              * Format arguments to our buffer (fmt::format_to() doesn't
              * append a null character).
              */
             _mBuf.clear();
+            BT_ASSERT(fmt);
             fmt::format_to(std::back_inserter(_mBuf), fmt, std::forward<ArgTs>(args)...);
             _mBuf.push_back('\0');
         }
 
-        this->_logStr<LogWriterT, LevelV, AppendCauseV>(fileName, funcName, lineNo, memData,
-                                                        initMsg, _mBuf.data());
-    }
-
-    /*
-     * Calls LogWriterT::write() with its arguments to log using the
-     * level `LevelV`.
-     *
-     * If `AppendCauseV` is true, this method also appends a cause to
-     * the error of the current thread using the concatenation of
-     * `initMsg` and `msg` as the message.
-     */
-    template <typename LogWriterT, Level LevelV, bool AppendCauseV>
-    void _logStr(const char * const fileName, const char * const funcName,
-                 const unsigned int lineNo, const MemData memData, const char * const initMsg,
-                 const char * const msg) const
-    {
-        /* Initial message and main message are required */
+        /* Initial message is required */
         BT_ASSERT(initMsg);
-        BT_ASSERT(msg);
 
         /* Log if needed */
-        if (this->wouldLog(LevelV)) {
+        if (wouldLog) {
             LogWriterT::write(fileName, funcName, lineNo, LevelV, _mTag.data(), memData, initMsg,
-                              msg);
+                              _mBuf.data());
         }
 
         /* Append an error cause if needed */
         if (AppendCauseV) {
             if (_mSelfMsgIter) {
                 bt_current_thread_error_append_cause_from_message_iterator(
-                    _mSelfMsgIter->libObjPtr(), fileName, lineNo, "%s%s", initMsg, msg);
+                    _mSelfMsgIter->libObjPtr(), fileName, lineNo, "%s%s", initMsg, _mBuf.data());
             } else if (_mSelfComp) {
                 bt_current_thread_error_append_cause_from_component(
-                    _mSelfComp->libObjPtr(), fileName, lineNo, "%s%s", initMsg, msg);
+                    _mSelfComp->libObjPtr(), fileName, lineNo, "%s%s", initMsg, _mBuf.data());
             } else if (_mSelfCompCls) {
                 bt_current_thread_error_append_cause_from_component_class(
-                    _mSelfCompCls->libObjPtr(), fileName, lineNo, "%s%s", initMsg, msg);
+                    _mSelfCompCls->libObjPtr(), fileName, lineNo, "%s%s", initMsg, _mBuf.data());
             } else {
                 BT_ASSERT(_mModuleName);
-                bt_current_thread_error_append_cause_from_unknown(_mModuleName->data(), fileName,
-                                                                  lineNo, "%s%s", initMsg, msg);
+                bt_current_thread_error_append_cause_from_unknown(
+                    _mModuleName->data(), fileName, lineNo, "%s%s", initMsg, _mBuf.data());
             }
         }
     }
@@ -641,39 +539,6 @@ inline const char *maybeNull(const char * const s) noexcept
 #define BT_CPPLOGE(_fmt, ...) BT_CPPLOGE_SPEC(_BT_CPPLOG_DEF_LOGGER, (_fmt), ##__VA_ARGS__)
 #define BT_CPPLOGF(_fmt, ...) BT_CPPLOGF_SPEC(_BT_CPPLOG_DEF_LOGGER, (_fmt), ##__VA_ARGS__)
 
-/*
- * Calls logStr() on `_logger` to log using the level `_lvl`.
- */
-#define BT_CPPLOG_STR_EX(_lvl, _logger, _msg)                                                      \
-    (_logger).template logStr<(_lvl), false>(__FILE__, __func__, __LINE__, (_msg))
-
-/*
- * BT_CPPLOG_STR_EX() with specific logging levels.
- */
-#define BT_CPPLOGT_STR_SPEC(_logger, _msg)                                                         \
-    BT_CPPLOG_STR_EX(bt2c::Logger::Level::Trace, (_logger), (_msg))
-#define BT_CPPLOGD_STR_SPEC(_logger, _msg)                                                         \
-    BT_CPPLOG_STR_EX(bt2c::Logger::Level::Debug, (_logger), (_msg))
-#define BT_CPPLOGI_STR_SPEC(_logger, _msg)                                                         \
-    BT_CPPLOG_STR_EX(bt2c::Logger::Level::Info, (_logger), (_msg))
-#define BT_CPPLOGW_STR_SPEC(_logger, _msg)                                                         \
-    BT_CPPLOG_STR_EX(bt2c::Logger::Level::Warning, (_logger), (_msg))
-#define BT_CPPLOGE_STR_SPEC(_logger, _msg)                                                         \
-    BT_CPPLOG_STR_EX(bt2c::Logger::Level::Error, (_logger), (_msg))
-#define BT_CPPLOGF_STR_SPEC(_logger, _msg)                                                         \
-    BT_CPPLOG_STR_EX(bt2c::Logger::Level::Fatal, (_logger), (_msg))
-
-/*
- * BT_CPPLOG_STR_EX() with specific logging levels and using the default
- * logger.
- */
-#define BT_CPPLOGT_STR(_msg) BT_CPPLOGT_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg))
-#define BT_CPPLOGD_STR(_msg) BT_CPPLOGD_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg))
-#define BT_CPPLOGI_STR(_msg) BT_CPPLOGI_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg))
-#define BT_CPPLOGW_STR(_msg) BT_CPPLOGW_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg))
-#define BT_CPPLOGE_STR(_msg) BT_CPPLOGE_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg))
-#define BT_CPPLOGF_STR(_msg) BT_CPPLOGF_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg))
-
 /*
  * Calls logMem() on `_logger` to log using the level `_lvl`.
  */
@@ -718,45 +583,6 @@ inline const char *maybeNull(const char * const s) noexcept
 #define BT_CPPLOGF_MEM(_memData, _fmt, ...)                                                        \
     BT_CPPLOGF_MEM_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_fmt), ##__VA_ARGS__)
 
-/*
- * Calls logMemStr() on `_logger` to log using the level `_lvl`.
- */
-#define BT_CPPLOG_MEM_STR_EX(_lvl, _logger, _memData, _msg)                                        \
-    (_logger).template logMemStr<(_lvl)>(__FILE__, __func__, __LINE__, (_memData), (_msg))
-
-/*
- * BT_CPPLOG_MEM_STR_EX() with specific logging levels.
- */
-#define BT_CPPLOGT_MEM_STR_SPEC(_logger, _memData, _msg)                                           \
-    BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::TRACE, (_logger), (_memData), (_msg))
-#define BT_CPPLOGD_MEM_STR_SPEC(_logger, _memData, _msg)                                           \
-    BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::DEBUG, (_logger), (_memData), (_msg))
-#define BT_CPPLOGI_MEM_STR_SPEC(_logger, _memData, _msg)                                           \
-    BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::INFO, (_logger), (_memData), (_msg))
-#define BT_CPPLOGW_MEM_STR_SPEC(_logger, _memData, _msg)                                           \
-    BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::WARNING, (_logger), (_memData), (_msg))
-#define BT_CPPLOGE_MEM_STR_SPEC(_logger, _memData, _msg)                                           \
-    BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::Error, (_logger), (_memData), (_msg))
-#define BT_CPPLOGF_MEM_STR_SPEC(_logger, _memData, _msg)                                           \
-    BT_CPPLOG_MEM_STR_EX(bt2c::Logger::Level::FATAL, (_logger), (_memData), (_msg))
-
-/*
- * BT_CPPLOG_MEM_STR_EX() with specific logging levels and using the
- * default logger.
- */
-#define BT_CPPLOGT_MEM_STR(_memData, _msg)                                                         \
-    BT_CPPLOGT_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg))
-#define BT_CPPLOGD_MEM_STR(_memData, _msg)                                                         \
-    BT_CPPLOGD_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg))
-#define BT_CPPLOGI_MEM_STR(_memData, _msg)                                                         \
-    BT_CPPLOGI_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg))
-#define BT_CPPLOGW_MEM_STR(_memData, _msg)                                                         \
-    BT_CPPLOGW_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg))
-#define BT_CPPLOGE_MEM_STR(_memData, _msg)                                                         \
-    BT_CPPLOGE_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg))
-#define BT_CPPLOGF_MEM_STR(_memData, _msg)                                                         \
-    BT_CPPLOGF_MEM_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_memData), (_msg))
-
 /*
  * Calls logErrno() on `_logger` to log using the level `_lvl` and
  * initial message `_initMsg`.
@@ -802,46 +628,6 @@ inline const char *maybeNull(const char * const s) noexcept
 #define BT_CPPLOGF_ERRNO(_initMsg, _fmt, ...)                                                      \
     BT_CPPLOGF_ERRNO_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_fmt), ##__VA_ARGS__)
 
-/*
- * Calls logErrnoStr() on `_logger` to log using the level `_lvl` and
- * initial message `_initMsg`.
- */
-#define BT_CPPLOG_ERRNO_STR_EX(_lvl, _logger, _initMsg, _msg)                                      \
-    (_logger).template logErrnoStr<(_lvl), false>(__FILE__, __func__, __LINE__, (_initMsg), (_msg))
-
-/*
- * BT_CPPLOG_ERRNO_STR_EX() with specific logging levels.
- */
-#define BT_CPPLOGT_ERRNO_STR_SPEC(_logger, _initMsg, _msg)                                         \
-    BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Trace, (_logger), (_initMsg), (_msg))
-#define BT_CPPLOGD_ERRNO_STR_SPEC(_logger, _initMsg, _msg)                                         \
-    BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Debug, (_logger), (_initMsg), (_msg))
-#define BT_CPPLOGI_ERRNO_STR_SPEC(_logger, _initMsg, _msg)                                         \
-    BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Info, (_logger), (_initMsg), (_msg))
-#define BT_CPPLOGW_ERRNO_STR_SPEC(_logger, _initMsg, _msg)                                         \
-    BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Warning, (_logger), (_initMsg), (_msg))
-#define BT_CPPLOGE_ERRNO_STR_SPEC(_logger, _initMsg, _msg)                                         \
-    BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Error, (_logger), (_initMsg), (_msg))
-#define BT_CPPLOGF_ERRNO_STR_SPEC(_logger, _initMsg, _msg)                                         \
-    BT_CPPLOG_ERRNO_STR_EX(bt2c::Logger::Level::Fatal, (_logger), (_initMsg), (_msg))
-
-/*
- * BT_CPPLOG_ERRNO_STR_EX() with specific logging levels and using the
- * default logger.
- */
-#define BT_CPPLOGT_ERRNO_STR(_initMsg, _msg)                                                       \
-    BT_CPPLOGT_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg))
-#define BT_CPPLOGD_ERRNO_STR(_initMsg, _msg)                                                       \
-    BT_CPPLOGD_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg))
-#define BT_CPPLOGI_ERRNO_STR(_initMsg, _msg)                                                       \
-    BT_CPPLOGI_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg))
-#define BT_CPPLOGW_ERRNO_STR(_initMsg, _msg)                                                       \
-    BT_CPPLOGW_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg))
-#define BT_CPPLOGE_ERRNO_STR(_initMsg, _msg)                                                       \
-    BT_CPPLOGE_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg))
-#define BT_CPPLOGF_ERRNO_STR(_initMsg, _msg)                                                       \
-    BT_CPPLOGF_ERRNO_STR_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg))
-
 /*
  * Calls log() on `_logger` with the `Error` level to log an error and
  * append a cause to the error of the current thread.
@@ -856,20 +642,6 @@ inline const char *maybeNull(const char * const s) noexcept
 #define BT_CPPLOGE_APPEND_CAUSE(_fmt, ...)                                                         \
     BT_CPPLOGE_APPEND_CAUSE_SPEC(_BT_CPPLOG_DEF_LOGGER, (_fmt), ##__VA_ARGS__)
 
-/*
- * Calls logStr() on `_logger` with the `Error` level to log an error and
- * append a cause to the error of the current thread.
- */
-#define BT_CPPLOGE_STR_APPEND_CAUSE_SPEC(_logger, _msg)                                            \
-    (_logger).template logStr<bt2c::Logger::Level::Error, true>(__FILE__, __func__, __LINE__,      \
-                                                                (_msg))
-
-/*
- * BT_CPPLOGE_STR_APPEND_CAUSE_SPEC() using the default logger.
- */
-#define BT_CPPLOGE_STR_APPEND_CAUSE(_msg)                                                          \
-    BT_CPPLOGE_STR_APPEND_CAUSE_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg))
-
 /*
  * Calls logErrorAndThrow() on `_logger` to log an error, append a cause
  * to the error of the current thread, and throw an instance of
@@ -885,21 +657,6 @@ inline const char *maybeNull(const char * const s) noexcept
 #define BT_CPPLOGE_APPEND_CAUSE_AND_THROW(_excCls, _fmt, ...)                                      \
     BT_CPPLOGE_APPEND_CAUSE_AND_THROW_SPEC(_BT_CPPLOG_DEF_LOGGER, _excCls, (_fmt), ##__VA_ARGS__)
 
-/*
- * Calls logErrorStrAndThrow() on `_logger` to log an error, append a
- * cause to the error of the current thread, and throw an instance of
- * `_excCls`.
- */
-#define BT_CPPLOGE_STR_APPEND_CAUSE_AND_THROW_SPEC(_logger, _excCls, _msg)                         \
-    (_logger).template logErrorStrAndThrow<true, _excCls>(__FILE__, __func__, __LINE__, (_msg))
-
-/*
- * BT_CPPLOGE_STR_APPEND_CAUSE_AND_THROW_SPEC() using the default
- * logger.
- */
-#define BT_CPPLOGE_STR_APPEND_CAUSE_AND_THROW(_excCls, _msg)                                       \
-    BT_CPPLOGE_STR_APPEND_CAUSE_AND_THROW_SPEC(_BT_CPPLOG_DEF_LOGGER, _excCls, (_msg))
-
 /*
  * Calls logErrorAndRethrow() on `_logger` to log an error, append a
  * cause to the error of the current thread, and throw an instance of
@@ -914,21 +671,6 @@ inline const char *maybeNull(const char * const s) noexcept
 #define BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW(_fmt, ...)                                             \
     BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW_SPEC(_BT_CPPLOG_DEF_LOGGER, (_fmt), ##__VA_ARGS__)
 
-/*
- * Calls logErrorStrAndRethrow() on `_logger` to log an error, append a
- * cause to the error of the current thread, and throw an instance of
- * `_excCls`.
- */
-#define BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW_SPEC(_logger, _msg)                                \
-    (_logger).template logErrorStrAndRethrow<true>(__FILE__, __func__, __LINE__, (_msg))
-
-/*
- * BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW_SPEC() using the default
- * logger.
- */
-#define BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW(_msg)                                              \
-    BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW_SPEC(_BT_CPPLOG_DEF_LOGGER, (_msg))
-
 /*
  * Calls logErrno() on `_logger` with the `Level::Error` level to log an
  * error and append a cause to the error of the current thread.
@@ -943,20 +685,6 @@ inline const char *maybeNull(const char * const s) noexcept
 #define BT_CPPLOGE_ERRNO_APPEND_CAUSE(_initMsg, _fmt, ...)                                         \
     BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_fmt), ##__VA_ARGS__)
 
-/*
- * Calls logErrnoStr() on `_logger` with the `Level::Error` level to log
- * an error and append a cause to the error of the current thread.
- */
-#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_SPEC(_logger, _initMsg, _msg)                            \
-    (_logger).template logErrnoStr<bt2c::Logger::Level::Error, true>(__FILE__, __func__, __LINE__, \
-                                                                     (_initMsg), (_msg))
-
-/*
- * BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_SPEC() using the default logger.
- */
-#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE(_initMsg, _msg)                                          \
-    BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg))
-
 /*
  * Calls logErrorErrnoAndThrow() on `_logger` to log an error, append a
  * cause to the error of the current thread, and throw an instance of
@@ -974,23 +702,6 @@ inline const char *maybeNull(const char * const s) noexcept
     BT_CPPLOGE_ERRNO_APPEND_CAUSE_AND_THROW_SPEC(_BT_CPPLOG_DEF_LOGGER, _excCls, (_initMsg),       \
                                                  (_fmt), ##__VA_ARGS__)
 
-/*
- * Calls logErrorErrnoStrAndThrow() on `_logger` to log an error, append
- * a cause to the error of the current thread, and throw an instance of
- * `_excCls`.
- */
-#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_THROW_SPEC(_logger, _excCls, _initMsg, _msg)         \
-    (_logger).template logErrorErrnoStrAndThrow<true, _excCls>(__FILE__, __func__, __LINE__,       \
-                                                               (_initMsg), (_msg))
-
-/*
- * BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_THROW_SPEC() using the default
- * logger.
- */
-#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_THROW(_excCls, _initMsg, _msg)                       \
-    BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_THROW_SPEC(_BT_CPPLOG_DEF_LOGGER, _excCls, (_initMsg),   \
-                                                     (_msg))
-
 /*
  * Calls logErrorErrnoAndRethrow() on `_logger` to log an error, append
  * a cause to the error of the current thread, and throw an instance of
@@ -1008,20 +719,4 @@ inline const char *maybeNull(const char * const s) noexcept
     BT_CPPLOGE_ERRNO_APPEND_CAUSE_AND_RETHROW_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_fmt),      \
                                                    ##__VA_ARGS__)
 
-/*
- * Calls logErrorErrnoStrAndRethrow() on `_logger` to log an error,
- * append a cause to the error of the current thread, and throw an
- * instance of `_excCls`.
- */
-#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_RETHROW_SPEC(_logger, _initMsg, _msg)                \
-    (_logger).template logErrorErrnoStrAndRethrow<true>(__FILE__, __func__, __LINE__, (_initMsg),  \
-                                                        (_msg))
-
-/*
- * BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_RETHROW_SPEC() using the
- * default logger.
- */
-#define BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_RETHROW(_initMsg, _msg)                              \
-    BT_CPPLOGE_ERRNO_STR_APPEND_CAUSE_AND_RETHROW_SPEC(_BT_CPPLOG_DEF_LOGGER, (_initMsg), (_msg))
-
 #endif /* BABELTRACE_CPP_COMMON_BT2C_LOGGING_HPP */
index 2b5cb79a8dbc7edd45a5d8dcc64fa0fc723f5bfa..4ee3548c09396cf0db7500cf95f3892424e2d598 100644 (file)
@@ -176,14 +176,14 @@ static struct stack *stack_new(struct bt_bfcr *bfcr)
 
     stack = g_new0(struct stack, 1);
     if (!stack) {
-        BT_CPPLOGE_STR_SPEC(bfcr->logger, "Failed to allocate one stack.");
+        BT_CPPLOGE_SPEC(bfcr->logger, "Failed to allocate one stack.");
         goto error;
     }
 
     stack->bfcr = bfcr;
     stack->entries = g_array_new(FALSE, TRUE, sizeof(struct stack_entry));
     if (!stack->entries) {
-        BT_CPPLOGE_STR_SPEC(bfcr->logger, "Failed to allocate a GArray.");
+        BT_CPPLOGE_SPEC(bfcr->logger, "Failed to allocate a GArray.");
         goto error;
     }
 
@@ -675,8 +675,8 @@ read_bit_array_class_and_call_continue(struct bt_bfcr *bfcr,
     }
 
     /* We are here; it means we don't have enough data to decode this */
-    BT_CPPLOGT_STR_SPEC(
-        bfcr->logger, "Not enough data to read the next basic field: appending to stitch buffer.");
+    BT_CPPLOGT_SPEC(bfcr->logger,
+                    "Not enough data to read the next basic field: appending to stitch buffer.");
     stitch_append_from_remaining_buf(bfcr);
     status = BT_BFCR_STATUS_EOF;
 
@@ -734,8 +734,8 @@ read_bit_array_class_and_call_begin(struct bt_bfcr *bfcr,
     }
 
     /* We are here; it means we don't have enough data to decode this */
-    BT_CPPLOGT_STR_SPEC(bfcr->logger,
-                        "Not enough data to read the next basic field: setting stitch buffer.");
+    BT_CPPLOGT_SPEC(bfcr->logger,
+                    "Not enough data to read the next basic field: setting stitch buffer.");
     stitch_set_from_remaining_buf(bfcr);
     bfcr->state = BFCR_STATE_READ_BASIC_CONTINUE;
     status = BT_BFCR_STATUS_EOF;
@@ -1116,12 +1116,12 @@ static inline enum bt_bfcr_status handle_state(struct bt_bfcr *bfcr)
 
 struct bt_bfcr *bt_bfcr_create(struct bt_bfcr_cbs cbs, void *data, const bt2c::Logger& logger)
 {
-    BT_CPPLOGD_STR_SPEC(logger, "Creating binary field class reader (BFCR).");
+    BT_CPPLOGD_SPEC(logger, "Creating binary field class reader (BFCR).");
 
     bt_bfcr *bfcr = new bt_bfcr {logger};
     bfcr->stack = stack_new(bfcr);
     if (!bfcr->stack) {
-        BT_CPPLOGE_STR_SPEC(bfcr->logger, "Cannot create BFCR's stack.");
+        BT_CPPLOGE_SPEC(bfcr->logger, "Cannot create BFCR's stack.");
         bt_bfcr_destroy(bfcr);
         bfcr = NULL;
         goto end;
@@ -1216,7 +1216,7 @@ size_t bt_bfcr_start(struct bt_bfcr *bfcr, struct ctf_field_class *cls, const ui
     }
 
     /* Run the machine! */
-    BT_CPPLOGT_STR_SPEC(bfcr->logger, "Running the state machine.");
+    BT_CPPLOGT_SPEC(bfcr->logger, "Running the state machine.");
 
     while (true) {
         *status = handle_state(bfcr);
@@ -1249,7 +1249,7 @@ size_t bt_bfcr_continue(struct bt_bfcr *bfcr, const uint8_t *buf, size_t sz,
                     fmt::ptr(bfcr), fmt::ptr(buf), sz);
 
     /* Continue running the machine */
-    BT_CPPLOGT_STR_SPEC(bfcr->logger, "Running the state machine.");
+    BT_CPPLOGT_SPEC(bfcr->logger, "Running the state machine.");
 
     while (true) {
         *status = handle_state(bfcr);
index 0de4c675e045c2849da1fe7892cab3a3136ff86c..4420746a7648818e63eeddcf7e285f91b2c13cc5 100644 (file)
@@ -550,7 +550,7 @@ static int relative_ptokens_to_field_path(GList *ptokens, struct ctf_field_path
         ret = ptokens_to_field_path(ptokens, &tail_field_path, parent_class, cur_index, ctx);
         if (ret) {
             /* Not found... yet */
-            BT_CPPLOGD_STR_SPEC(ctx->logger, "Not found at this point.");
+            BT_CPPLOGD_SPEC(ctx->logger, "Not found at this point.");
             ctf_field_path_clear(&tail_field_path);
         } else {
             /* Found: stitch tail field path to head field path */
index 846df316d2d9afadf61436d9a6ea94a85d970107..b6de4d618525de11823fe22c6fe12fccd03fbd67 100644 (file)
@@ -165,7 +165,7 @@ static int decode_packet(FILE *in_fp, FILE *out_fp, int byte_order, bool *is_uui
             toread = (header.packet_size - header.content_size) / CHAR_BIT;
             fseek_ret = fseek(in_fp, toread, SEEK_CUR);
             if (fseek_ret < 0) {
-                BT_CPPLOGW_STR_SPEC(logger, "Missing padding at the end of the metadata stream.");
+                BT_CPPLOGW_SPEC(logger, "Missing padding at the end of the metadata stream.");
             }
             break;
         }
index 826cca144c6b6273be4888f1e081ae7c0230fcac..8bc0eeda5067dbbe71f134f29893dd40dc62d289 100644 (file)
@@ -12,7 +12,7 @@
 #include "plugins/ctf/common/src/metadata/tsdl/parser-wrap.hpp"
 #include "plugins/ctf/common/src/metadata/tsdl/scanner.hpp"
 
-#define YY_FATAL_ERROR(_msg)   BT_CPPLOGF_STR_SPEC(currentCtfScanner->logger, _msg)
+#define YY_FATAL_ERROR(_msg)   BT_CPPLOGF_SPEC(currentCtfScanner->logger, "{}", _msg)
 
 #define PARSE_INTEGER_LITERAL(base)                                    \
        do {                                                            \
index cb13f63b8c559f8ea916177c91339caf61db36c9..d124b3f300fde305190c86967cb03239a2bf95d8 100644 (file)
@@ -45,7 +45,7 @@ objstack *objstack_create(const bt2c::Logger& parentLogger)
     objstack = new ::objstack {parentLogger};
     node = (objstack_node *) calloc(sizeof(struct objstack_node) + OBJSTACK_INIT_LEN, sizeof(char));
     if (!node) {
-        BT_CPPLOGE_STR_SPEC(objstack->logger, "Failed to allocate one object stack node.");
+        BT_CPPLOGE_SPEC(objstack->logger, "Failed to allocate one object stack node.");
         delete objstack;
         return NULL;
     }
@@ -94,7 +94,7 @@ static struct objstack_node *objstack_append_node(struct objstack *objstack)
     new_node = (objstack_node *) calloc(sizeof(struct objstack_node) + (last_node->len << 1),
                                         sizeof(char));
     if (!new_node) {
-        BT_CPPLOGE_STR_SPEC(objstack->logger, "Failed to allocate one object stack node.");
+        BT_CPPLOGE_SPEC(objstack->logger, "Failed to allocate one object stack node.");
         return NULL;
     }
     bt_list_add_tail(&new_node->node, &objstack->head);
index 7ae25b69d3d8fa2233e2d60194a4ba64a089983c..bf2d90c595be7e7a36c549ffac6ce4762639faeb 100644 (file)
@@ -31,7 +31,7 @@ thread_local const ctf_scanner *currentCtfScanner;
         std::string str(size, '\0');                                                               \
         int written = snprintf(&str[0], size + 1, (_fmt), ##args);                                 \
         BT_ASSERT(size == written);                                                                \
-        BT_CPPLOGT_STR_SPEC(currentCtfScanner->logger, str.c_str());                               \
+        BT_CPPLOGT_SPEC(currentCtfScanner->logger, "{}", str.c_str());                             \
     } while (0)
 
 /* Join two lists, put "add" at the end of "head".  */
@@ -803,8 +803,7 @@ static int set_parent_node(struct ctf_node *node,
 
        switch (node->type) {
        case NODE_ROOT:
-               BT_CPPLOGE_STR_SPEC(currentCtfScanner->logger,
-                       "Trying to reparent root node.");
+               BT_CPPLOGE_SPEC(currentCtfScanner->logger, "Trying to reparent root node.");
                return -EINVAL;
 
        case NODE_EVENT:
index 7900662a847f92604bb1fa252b26e5db6cd53ac8..48034a3fcbdeba2866eaa6d5983c704402b7c510 100644 (file)
@@ -4436,7 +4436,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *ctx, stru
 {
     int ret = 0;
 
-    BT_CPPLOGI_STR_SPEC(ctx->logger, "Visiting metadata's AST to generate CTF IR objects.");
+    BT_CPPLOGI_SPEC(ctx->logger, "Visiting metadata's AST to generate CTF IR objects.");
 
     switch (node->type) {
     case NODE_ROOT:
@@ -4472,7 +4472,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *ctx, stru
             }
 
             if (!got_trace_decl) {
-                BT_CPPLOGD_STR_SPEC(ctx->logger, "Incomplete AST: need trace (`trace` block).");
+                BT_CPPLOGD_SPEC(ctx->logger, "Incomplete AST: need trace (`trace` block).");
                 ret = -EINCOMPLETE;
                 goto end;
             }
index 1d146f3dfee45bcaeb43d3d403ea40ed0cea5cdd..50a545bba940265ccbd1c54b8374908ed602b229 100644 (file)
@@ -599,11 +599,11 @@ read_dscope_begin_state(struct ctf_msg_iter *msg_it, struct ctf_field_class *dsc
     switch (bfcr_status) {
     case BT_BFCR_STATUS_OK:
         /* Field class was read completely */
-        BT_CPPLOGT_STR_SPEC(msg_it->logger, "Field was completely decoded.");
+        BT_CPPLOGT_SPEC(msg_it->logger, "Field was completely decoded.");
         msg_it->state = done_state;
         break;
     case BT_BFCR_STATUS_EOF:
-        BT_CPPLOGT_STR_SPEC(msg_it->logger, "BFCR needs more data to decode field completely.");
+        BT_CPPLOGT_SPEC(msg_it->logger, "BFCR needs more data to decode field completely.");
         msg_it->state = continue_state;
         break;
     default:
@@ -655,12 +655,12 @@ static enum ctf_msg_iter_status read_dscope_continue_state(struct ctf_msg_iter *
     switch (bfcr_status) {
     case BT_BFCR_STATUS_OK:
         /* Type was read completely. */
-        BT_CPPLOGT_STR_SPEC(msg_it->logger, "Field was completely decoded.");
+        BT_CPPLOGT_SPEC(msg_it->logger, "Field was completely decoded.");
         msg_it->state = done_state;
         break;
     case BT_BFCR_STATUS_EOF:
         /* Stay in this continue state. */
-        BT_CPPLOGT_STR_SPEC(msg_it->logger, "BFCR needs more data to decode field completely.");
+        BT_CPPLOGT_SPEC(msg_it->logger, "BFCR needs more data to decode field completely.");
         break;
     default:
         BT_CPPLOGE_APPEND_CAUSE_SPEC(msg_it->logger,
@@ -2728,7 +2728,7 @@ void ctf_msg_iter_destroy(struct ctf_msg_iter *msg_it)
                     fmt::ptr(msg_it));
 
     if (msg_it->stack) {
-        BT_CPPLOGD_STR_SPEC(msg_it->logger, "Destroying field stack.");
+        BT_CPPLOGD_SPEC(msg_it->logger, "Destroying field stack.");
         stack_destroy(msg_it->stack);
     }
 
@@ -2761,7 +2761,7 @@ enum ctf_msg_iter_status ctf_msg_iter_get_next_message(struct ctf_msg_iter *msg_
     while (true) {
         status = handle_state(msg_it);
         if (G_UNLIKELY(status == CTF_MSG_ITER_STATUS_AGAIN)) {
-            BT_CPPLOGD_STR_SPEC(msg_it->logger, "Medium returned CTF_MSG_ITER_STATUS_AGAIN.");
+            BT_CPPLOGD_SPEC(msg_it->logger, "Medium returned CTF_MSG_ITER_STATUS_AGAIN.");
             goto end;
         } else if (G_UNLIKELY(status != CTF_MSG_ITER_STATUS_OK)) {
             BT_CPPLOGE_APPEND_CAUSE_SPEC(msg_it->logger,
@@ -2895,7 +2895,7 @@ static enum ctf_msg_iter_status decode_until_state(struct ctf_msg_iter *msg_it,
 
         status = handle_state(msg_it);
         if (G_UNLIKELY(status == CTF_MSG_ITER_STATUS_AGAIN)) {
-            BT_CPPLOGD_STR_SPEC(msg_it->logger, "Medium returned CTF_MSG_ITER_STATUS_AGAIN.");
+            BT_CPPLOGD_SPEC(msg_it->logger, "Medium returned CTF_MSG_ITER_STATUS_AGAIN.");
             goto end;
         } else if (G_UNLIKELY(status != CTF_MSG_ITER_STATUS_OK)) {
             BT_CPPLOGE_APPEND_CAUSE_SPEC(msg_it->logger,
index 79d4839ab85e637140cd163bd837b7c0d9741625..cebf19f61a5aee7097cbb8181611646a43456184 100644 (file)
@@ -157,8 +157,8 @@ static int append_lttng_trace_path_ust_uid(const struct fs_sink_trace *trace, GS
 
     v = bt_trace_borrow_environment_entry_value_by_name_const(tc, "tracer_buffering_id");
     if (!v || !bt_value_is_signed_integer(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger,
-                            "Couldn't get environment value: name=\"tracer_buffering_id\"");
+        BT_CPPLOGI_SPEC(trace->logger,
+                        "Couldn't get environment value: name=\"tracer_buffering_id\"");
         goto error;
     }
 
@@ -166,8 +166,8 @@ static int append_lttng_trace_path_ust_uid(const struct fs_sink_trace *trace, GS
 
     v = bt_trace_borrow_environment_entry_value_by_name_const(tc, "architecture_bit_width");
     if (!v || !bt_value_is_signed_integer(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger,
-                            "Couldn't get environment value: name=\"architecture_bit_width\"");
+        BT_CPPLOGI_SPEC(trace->logger,
+                        "Couldn't get environment value: name=\"architecture_bit_width\"");
         goto error;
     }
 
@@ -193,7 +193,7 @@ static int append_lttng_trace_path_ust_pid(const struct fs_sink_trace *trace, GS
 
     v = bt_trace_borrow_environment_entry_value_by_name_const(tc, "procname");
     if (!v || !bt_value_is_string(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"procname\"");
+        BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"procname\"");
         goto error;
     }
 
@@ -201,7 +201,7 @@ static int append_lttng_trace_path_ust_pid(const struct fs_sink_trace *trace, GS
 
     v = bt_trace_borrow_environment_entry_value_by_name_const(tc, "vpid");
     if (!v || !bt_value_is_signed_integer(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"vpid\"");
+        BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"vpid\"");
         goto error;
     }
 
@@ -209,8 +209,7 @@ static int append_lttng_trace_path_ust_pid(const struct fs_sink_trace *trace, GS
 
     v = bt_trace_borrow_environment_entry_value_by_name_const(tc, "vpid_datetime");
     if (!v || !bt_value_is_string(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger,
-                            "Couldn't get environment value: name=\"vpid_datetime\"");
+        BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"vpid_datetime\"");
         goto error;
     }
 
@@ -250,7 +249,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace)
 
     v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "tracer_name");
     if (!v || !bt_value_is_string(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_name\"");
+        BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_name\"");
         goto error;
     }
 
@@ -263,7 +262,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace)
 
     v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "tracer_major");
     if (!v || !bt_value_is_signed_integer(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_major\"");
+        BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_major\"");
         goto error;
     }
 
@@ -271,7 +270,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace)
 
     v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "tracer_minor");
     if (!v || !bt_value_is_signed_integer(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_minor\"");
+        BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_minor\"");
         goto error;
     }
 
@@ -286,8 +285,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace)
 
     v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "hostname");
     if (!v || !bt_value_is_string(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger,
-                            "Couldn't get environment value: name=\"tracer_hostname\"");
+        BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"tracer_hostname\"");
         goto error;
     }
 
@@ -295,7 +293,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace)
 
     v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "trace_name");
     if (!v || !bt_value_is_string(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"trace_name\"");
+        BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"trace_name\"");
         goto error;
     }
 
@@ -304,8 +302,8 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace)
     v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace,
                                                               "trace_creation_datetime");
     if (!v || !bt_value_is_string(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger,
-                            "Couldn't get environment value: name=\"trace_creation_datetime\"");
+        BT_CPPLOGI_SPEC(trace->logger,
+                        "Couldn't get environment value: name=\"trace_creation_datetime\"");
         goto error;
     }
 
@@ -319,7 +317,7 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace)
 
     v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace, "domain");
     if (!v || !bt_value_is_string(v)) {
-        BT_CPPLOGI_STR_SPEC(trace->logger, "Couldn't get environment value: name=\"domain\"");
+        BT_CPPLOGI_SPEC(trace->logger, "Couldn't get environment value: name=\"domain\"");
         goto error;
     }
 
@@ -332,8 +330,8 @@ static GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace)
         v = bt_trace_borrow_environment_entry_value_by_name_const(trace->ir_trace,
                                                                   "tracer_buffering_scheme");
         if (!v || !bt_value_is_string(v)) {
-            BT_CPPLOGI_STR_SPEC(trace->logger,
-                                "Couldn't get environment value: name=\"tracer_buffering_scheme\"");
+            BT_CPPLOGI_SPEC(trace->logger,
+                            "Couldn't get environment value: name=\"tracer_buffering_scheme\"");
             goto error;
         }
 
index 52d3d426ad33da8e6d9ad21561aee893a7895383..6b0c88da9b0c59e0b127b36e84f27c4e5f6ce3e4 100644 (file)
@@ -965,8 +965,7 @@ bt_component_class_sink_consume_method_status ctf_fs_sink_consume(bt_self_compon
                 break;
             case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
                 /* Ignore */
-                BT_CPPLOGD_STR_SPEC(fs_sink->logger,
-                                    "Ignoring message iterator inactivity message.");
+                BT_CPPLOGD_SPEC(fs_sink->logger, "Ignoring message iterator inactivity message.");
                 break;
             case BT_MESSAGE_TYPE_STREAM_BEGINNING:
                 status = handle_stream_beginning_msg(fs_sink, msg);
index 5c8cf801da1ada833ed184ce3a08ccbc3da42b9f..ca634b952aba11b45143748c9b34a37824c0ca46 100644 (file)
@@ -880,13 +880,13 @@ static inline int translate_option_field_class(ctf::sink::TraceIrToCtfIrCtx *ctx
     append_to_parent_field_class(ctx, &fc->base);
     ret = cur_path_stack_push(ctx, NULL, false, content_ir_fc, &fc->base);
     if (ret) {
-        BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate option field class content.");
+        BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate option field class content.");
         goto end;
     }
 
     ret = translate_field_class(ctx);
     if (ret) {
-        BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate option field class content.");
+        BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate option field class content.");
         goto end;
     }
 
@@ -1071,13 +1071,13 @@ static inline int translate_static_array_field_class(ctf::sink::TraceIrToCtfIrCt
     append_to_parent_field_class(ctx, &fc->base.base);
     ret = cur_path_stack_push(ctx, NULL, false, elem_ir_fc, &fc->base.base);
     if (ret) {
-        BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate static array field class element.");
+        BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate static array field class element.");
         goto end;
     }
 
     ret = translate_field_class(ctx);
     if (ret) {
-        BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate static array field class element.");
+        BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate static array field class element.");
         goto end;
     }
 
@@ -1111,13 +1111,13 @@ static inline int translate_dynamic_array_field_class(ctf::sink::TraceIrToCtfIrC
     append_to_parent_field_class(ctx, &fc->base.base);
     ret = cur_path_stack_push(ctx, NULL, false, elem_ir_fc, &fc->base.base);
     if (ret) {
-        BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate dynamic array field class element.");
+        BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate dynamic array field class element.");
         goto end;
     }
 
     ret = translate_field_class(ctx);
     if (ret) {
-        BT_CPPLOGE_STR_SPEC(ctx->logger, "Cannot translate dynamic array field class element.");
+        BT_CPPLOGE_SPEC(ctx->logger, "Cannot translate dynamic array field class element.");
         goto end;
     }
 
index 22aa309f93df6244727a48e2926e113cf3d59c1a..d2f7e102eb85734881aa90dbc4ca9e899632e835 100644 (file)
@@ -392,8 +392,7 @@ build_index_from_idx_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_file_
     ctf_msg_iter_packet_properties props;
     int ret = ctf_msg_iter_get_packet_properties(msg_iter, &props);
     if (ret) {
-        BT_CPPLOGI_STR_SPEC(ds_file->logger,
-                            "Cannot read first packet's header and context fields.");
+        BT_CPPLOGI_SPEC(ds_file->logger, "Cannot read first packet's header and context fields.");
         return bt2s::nullopt;
     }
 
@@ -401,7 +400,7 @@ build_index_from_idx_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_file_
         ctf_trace_class_borrow_stream_class_by_id(ds_file->metadata->tc, props.stream_class_id);
     BT_ASSERT(sc);
     if (!sc->default_clock_class) {
-        BT_CPPLOGI_STR_SPEC(ds_file->logger, "Cannot find stream class's default clock class.");
+        BT_CPPLOGI_SPEC(ds_file->logger, "Cannot find stream class's default clock class.");
         return bt2s::nullopt;
     }
 
@@ -448,8 +447,8 @@ build_index_from_idx_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_file_
 
     const char *file_pos = g_mapped_file_get_contents(mapped_file.get()) + sizeof(*header);
     if (be32toh(header->magic) != CTF_INDEX_MAGIC) {
-        BT_CPPLOGW_STR_SPEC(ds_file->logger,
-                            "Invalid LTTng trace index: \"magic\" field validation failed");
+        BT_CPPLOGW_SPEC(ds_file->logger,
+                        "Invalid LTTng trace index: \"magic\" field validation failed");
         return bt2s::nullopt;
     }
 
@@ -522,7 +521,7 @@ build_index_from_idx_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_file_
         ret = convert_cycles_to_ns(sc->default_clock_class, index_entry.timestamp_begin,
                                    &index_entry.timestamp_begin_ns);
         if (ret) {
-            BT_CPPLOGI_STR_SPEC(
+            BT_CPPLOGI_SPEC(
                 ds_file->logger,
                 "Failed to convert raw timestamp to nanoseconds since Epoch during index parsing");
             return bt2s::nullopt;
@@ -530,7 +529,7 @@ build_index_from_idx_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_file_
         ret = convert_cycles_to_ns(sc->default_clock_class, index_entry.timestamp_end,
                                    &index_entry.timestamp_end_ns);
         if (ret) {
-            BT_CPPLOGI_STR_SPEC(
+            BT_CPPLOGI_SPEC(
                 ds_file->logger,
                 "Failed to convert raw timestamp to nanoseconds since Epoch during LTTng trace index parsing");
             return bt2s::nullopt;
@@ -574,8 +573,8 @@ static int init_index_entry(ctf_fs_ds_index_entry& entry, struct ctf_fs_ds_file
         int ret = convert_cycles_to_ns(sc->default_clock_class, props->snapshots.beginning_clock,
                                        &entry.timestamp_begin_ns);
         if (ret) {
-            BT_CPPLOGI_STR_SPEC(ds_file->logger,
-                                "Failed to convert raw timestamp to nanoseconds since Epoch.");
+            BT_CPPLOGI_SPEC(ds_file->logger,
+                            "Failed to convert raw timestamp to nanoseconds since Epoch.");
             return ret;
         }
     } else {
@@ -590,8 +589,8 @@ static int init_index_entry(ctf_fs_ds_index_entry& entry, struct ctf_fs_ds_file
         int ret = convert_cycles_to_ns(sc->default_clock_class, props->snapshots.end_clock,
                                        &entry.timestamp_end_ns);
         if (ret) {
-            BT_CPPLOGI_STR_SPEC(ds_file->logger,
-                                "Failed to convert raw timestamp to nanoseconds since Epoch.");
+            BT_CPPLOGI_SPEC(ds_file->logger,
+                            "Failed to convert raw timestamp to nanoseconds since Epoch.");
             return ret;
         }
     } else {
@@ -615,8 +614,8 @@ build_index_from_stream_file(struct ctf_fs_ds_file *ds_file, struct ctf_fs_ds_fi
         struct ctf_msg_iter_packet_properties props;
 
         if (currentPacketOffset.bytes() > ds_file->file->size) {
-            BT_CPPLOGE_STR_SPEC(ds_file->logger,
-                                "Unexpected current packet's offset (larger than file).");
+            BT_CPPLOGE_SPEC(ds_file->logger,
+                            "Unexpected current packet's offset (larger than file).");
             return bt2s::nullopt;
         } else if (currentPacketOffset.bytes() == ds_file->file->size) {
             /* No more data */
index e0f734405948b1ba92050598f4e864f18417a337..e86d30cecf8544041365c4d23890b44722c01fe4 100644 (file)
@@ -406,7 +406,7 @@ static int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, const
         bt_common_get_page_size(static_cast<int>(ctf_fs_trace->logger.level())) * 8,
         ctf_fs_ds_file_medops, ds_file.get(), nullptr, ctf_fs_trace->logger);
     if (!msg_iter) {
-        BT_CPPLOGE_STR_SPEC(ctf_fs_trace->logger, "Cannot create a CTF message iterator.");
+        BT_CPPLOGE_SPEC(ctf_fs_trace->logger, "Cannot create a CTF message iterator.");
         return -1;
     }
 
@@ -1282,7 +1282,7 @@ static int fix_packet_index_tracer_bugs(ctf_fs_trace *trace)
          * are needed. Failing to extract these entries is not
          * an error.
          */
-        BT_CPPLOGI_STR_SPEC(
+        BT_CPPLOGI_SPEC(
             trace->logger,
             "Cannot extract tracer information necessary to compare with buggy versions.");
         return 0;
@@ -1290,9 +1290,8 @@ static int fix_packet_index_tracer_bugs(ctf_fs_trace *trace)
 
     /* Check if the trace may be affected by old tracer bugs. */
     if (is_tracer_affected_by_lttng_event_after_packet_bug(&current_tracer_info)) {
-        BT_CPPLOGI_STR_SPEC(
-            trace->logger,
-            "Trace may be affected by LTTng tracer packet timestamp bug. Fixing up.");
+        BT_CPPLOGI_SPEC(trace->logger,
+                        "Trace may be affected by LTTng tracer packet timestamp bug. Fixing up.");
         ret = fix_index_lttng_event_after_packet_bug(trace);
         if (ret) {
             BT_CPPLOGE_APPEND_CAUSE_SPEC(trace->logger,
@@ -1303,9 +1302,8 @@ static int fix_packet_index_tracer_bugs(ctf_fs_trace *trace)
     }
 
     if (is_tracer_affected_by_barectf_event_before_packet_bug(&current_tracer_info)) {
-        BT_CPPLOGI_STR_SPEC(
-            trace->logger,
-            "Trace may be affected by barectf tracer packet timestamp bug. Fixing up.");
+        BT_CPPLOGI_SPEC(trace->logger,
+                        "Trace may be affected by barectf tracer packet timestamp bug. Fixing up.");
         ret = fix_index_barectf_event_before_packet_bug(trace);
         if (ret) {
             BT_CPPLOGE_APPEND_CAUSE_SPEC(trace->logger,
index 79fbe55052a4abb1ae9643669b9d45cbbc051844..6368181000f641718cb9c192cda053ba131b2341 100644 (file)
@@ -1387,7 +1387,7 @@ lttng_live_msg_iter_next(bt_self_message_iterator *self_msg_it, bt_message_array
                      * that of the current candidate message. We
                      * must break the tie in a predictable manner.
                      */
-                    BT_CPPLOGD_STR_SPEC(
+                    BT_CPPLOGD_SPEC(
                         lttng_live_msg_iter->logger,
                         "Two of the next message candidates have the same timestamps, pick one deterministically.");
                     /*
index ea2df4d03136316bd8df66ee8e034ab5547d26f8..fb2a111936a1213594de541447862cdbb4de85e0 100644 (file)
@@ -13,7 +13,7 @@ namespace bt2mux {
 Comp::Comp(const bt2::SelfFilterComponent selfComp, const bt2::ConstMapValue params, void *) :
     bt2::UserFilterComponent<Comp, MsgIter> {selfComp, "PLUGIN/FLT.UTILS.MUXER"}
 {
-    BT_CPPLOGI_STR("Initializing component.");
+    BT_CPPLOGI("Initializing component.");
 
     /* No parameters expected */
     if (!params.isEmpty()) {
@@ -28,10 +28,10 @@ Comp::Comp(const bt2::SelfFilterComponent selfComp, const bt2::ConstMapValue par
     try {
         this->_addOutputPort("out");
     } catch (const bt2c::Error&) {
-        BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW("Failed to add a single output port.");
+        BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW("Failed to add a single output port.");
     }
 
-    BT_CPPLOGI_STR("Initialized component.");
+    BT_CPPLOGI("Initialized component.");
 }
 
 void Comp::_inputPortConnected(const bt2::SelfComponentInputPort, const bt2::ConstOutputPort)
@@ -44,7 +44,7 @@ void Comp::_addAvailInputPort()
     try {
         this->_addInputPort(fmt::format("in{}", this->_inputPorts().length()));
     } catch (const bt2c::Error&) {
-        BT_CPPLOGE_STR_APPEND_CAUSE_AND_RETHROW("Failed to add an available input port.");
+        BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW("Failed to add an available input port.");
     }
 
     BT_CPPLOGI("Added one available input port: name={}", this->_inputPorts().back().name());
index c3e8c3db1870cc20d3973ab7b6ab828b37020d0d..2754bb1143c61bc597fc59bbda2c13569039add3 100644 (file)
@@ -367,18 +367,17 @@ bool MsgIter::_HeapComparator::operator()(
              * the oldest one, that is, the one having the smallest
              * timestamp.
              */
-            BT_CPPLOGT_STR("Timestamp of message A is less than timestamp of message B: oldest=A");
+            BT_CPPLOGT("Timestamp of message A is less than timestamp of message B: oldest=A");
             return true;
         } else if (*msgTsA > *msgTsB) {
-            BT_CPPLOGT_STR(
-                "Timestamp of message A is greater than timestamp of message B: oldest=B");
+            BT_CPPLOGT("Timestamp of message A is greater than timestamp of message B: oldest=B");
             return false;
         }
     } else if (msgTsA && !msgTsB) {
-        BT_CPPLOGT_STR("Message A has a timestamp, but message B has none: oldest=B");
+        BT_CPPLOGT("Message A has a timestamp, but message B has none: oldest=B");
         return false;
     } else if (!msgTsA && msgTsB) {
-        BT_CPPLOGT_STR("Message B has a timestamp, but message A has none: oldest=A");
+        BT_CPPLOGT("Message B has a timestamp, but message A has none: oldest=A");
         return true;
     }
 
This page took 0.04444 seconds and 4 git commands to generate.