sink.text.pretty: print inactivity msg handling with BT_LOGD_STR
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 22 Apr 2019 20:21:07 +0000 (16:21 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:39 +0000 (18:19 -0400)
Instead of printing that the component received a message iterator
inactivity message to standard error; log this information with
BT_LOGD().

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
plugins/text/pretty/Makefile.am
plugins/text/pretty/logging.c [new file with mode: 0644]
plugins/text/pretty/logging.h [new file with mode: 0644]
plugins/text/pretty/pretty.c

index 7d990aa04e086929bfb2a4f9d7357f61088e7081..7af0f29d5c59891901db627ada2d71a184908d20 100644 (file)
@@ -4,6 +4,8 @@ noinst_LTLIBRARIES = libbabeltrace-plugin-text-pretty-cc.la
 
 # ctf-text plugin
 libbabeltrace_plugin_text_pretty_cc_la_SOURCES = \
+       logging.c \
+       logging.h \
        pretty.c \
-       print.c \
-       pretty.h
+       pretty.h \
+       print.c
diff --git a/plugins/text/pretty/logging.c b/plugins/text/pretty/logging.c
new file mode 100644 (file)
index 0000000..42595e7
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define BT_LOG_OUTPUT_LEVEL bt_plugin_text_pretty_log_level
+#include <babeltrace/logging-internal.h>
+
+BT_LOG_INIT_LOG_LEVEL(bt_plugin_text_pretty_log_level,
+       "BABELTRACE_SINK_TEXT_PRETTY_LOG_LEVEL");
diff --git a/plugins/text/pretty/logging.h b/plugins/text/pretty/logging.h
new file mode 100644 (file)
index 0000000..417ca6a
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef PLUGINS_TEXT_PRETTY_LOG_LEVEL
+#define PLUGINS_TEXT_PRETTY_LOG_LEVEL
+
+/*
+ * Copyright (c) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define BT_LOG_OUTPUT_LEVEL bt_plugin_text_pretty_log_level
+#include <babeltrace/logging-internal.h>
+
+BT_LOG_LEVEL_EXTERN_SYMBOL(bt_plugin_text_pretty_log_level);
+
+#endif /* PLUGINS_TEXT_PRETTY_LOG_LEVEL */
index 63a6c879ac3b2b19fec94c8e34c7723999a9e048..6b6e3cd55f229f3af781d6f5f6c00a3308292cfa 100644 (file)
@@ -23,6 +23,9 @@
  * SOFTWARE.
  */
 
+#define BT_LOG_TAG "PLUGIN-TEXT-PRETTY-SINK"
+#include "logging.h"
+
 #include <babeltrace/babeltrace.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/common-internal.h>
@@ -139,7 +142,7 @@ bt_self_component_status handle_message(
                }
                break;
        case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
-               fprintf(stderr, "Message iterator inactivity message\n");
+               BT_LOGD_STR("Message iterator inactivity message.");
                break;
        case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
        case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
This page took 0.026873 seconds and 4 git commands to generate.