ctf: use `bt2c::Logger` throughout `src.ctf.fs`, `src.ctf.lttng-live`
[babeltrace.git] / src / plugins / ctf / common / src / metadata / tsdl / logging.hpp
index 234a1d609aad7d35b74e2702142a74afb9b18b6c..ee019a3c04cf9f78c2f2be8068878bf19f183dcc 100644 (file)
@@ -9,56 +9,18 @@
 
 #include <babeltrace2/babeltrace.h>
 
-#include "logging/comp-logging.h"
-#include "logging/log.h"
+#include "cpp-common/bt2c/logging.hpp"
 
-/*
- * This global log level is for the generated lexer and parser: we can't
- * use a contextual log level for their "tracing", so they rely on this.
- */
-BT_LOG_LEVEL_EXTERN_SYMBOL(ctf_plugin_metadata_log_level);
-
-/*
- * To be used by functions without a context structure to pass all the
- * logging configuration at once.
- */
-struct meta_log_config
-{
-    bt_logging_level log_level;
-
-    /* Weak, exactly one of these must be set */
-    bt_self_component *self_comp;
-    bt_self_component_class *self_comp_class;
-};
-
-#define _BT_LOGT_LINENO(_lineno, _msg, args...)                                                    \
-    BT_LOGT("At line %u in metadata stream: " _msg, _lineno, ##args)
-
-#define _BT_LOGW_LINENO(_lineno, _msg, args...)                                                    \
-    BT_LOGW("At line %u in metadata stream: " _msg, _lineno, ##args)
-
-#define _BT_LOGE_APPEND_CAUSE_LINENO(_lineno, _msg, args...)                                       \
-    do {                                                                                           \
-        BT_LOGE("At line %u in metadata stream: " _msg, _lineno, ##args);                          \
-        (void) BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(                                  \
-            "CTF metadata parser", "At line %u in metadata stream: " _msg, _lineno, ##args);       \
-    } while (0)
-
-#define _BT_COMP_LOGT_LINENO(_lineno, _msg, args...)                                               \
-    BT_COMP_LOGT("At line %u in metadata stream: " _msg, _lineno, ##args)
-
-#define _BT_COMP_LOGW_LINENO(_lineno, _msg, args...)                                               \
-    BT_COMP_LOGW("At line %u in metadata stream: " _msg, _lineno, ##args)
+#define _BT_CPPLOGT_LINENO(logger, _lineno, _msg, args...)                                         \
+    BT_CPPLOGT_SPEC((logger), "At line {} in metadata stream: " _msg, _lineno, ##args)
 
-#define _BT_COMP_LOGE_LINENO(_lineno, _msg, args...)                                               \
-    BT_COMP_LOGE("At line %u in metadata stream: " _msg, _lineno, ##args)
+#define _BT_CPPLOGW_LINENO(logger, _lineno, _msg, args...)                                         \
+    BT_CPPLOGW_SPEC((logger), "At line {} in metadata stream: " _msg, _lineno, ##args)
 
-#define _BT_COMP_LOGE_APPEND_CAUSE_LINENO(_lineno, _msg, args...)                                  \
-    BT_COMP_LOGE_APPEND_CAUSE(BT_COMP_LOG_SELF_COMP, "At line %u in metadata stream: " _msg,       \
-                              _lineno, ##args)
+#define _BT_CPPLOGE_LINENO(logger, _lineno, _msg, args...)                                         \
+    BT_CPPLOGE_SPEC((logger), "At line {} in metadata stream: " _msg, _lineno, ##args)
 
-#define _BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(_msg, args...)                                    \
-    BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(BT_COMP_LOG_SELF_COMP, BT_COMP_LOG_SELF_COMP_CLASS,    \
-                                            _msg, ##args)
+#define _BT_CPPLOGE_APPEND_CAUSE_LINENO(logger, _lineno, _msg, args...)                            \
+    BT_CPPLOGE_APPEND_CAUSE_SPEC((logger), "At line {} in metadata stream: " _msg, _lineno, ##args)
 
 #endif /* CTF_METADATA_LOGGING_H */
This page took 0.025508 seconds and 4 git commands to generate.