sink.text.pretty: print inactivity msg handling with BT_LOGD_STR
[babeltrace.git] / plugins / text / pretty / pretty.c
index ef1224b781bea6b829ca72f350355d58e7c51a7e..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>
@@ -62,6 +65,9 @@ const char *plugin_options[] = {
        "field-callsite",
 };
 
+static
+const char * const in_port_name = "in";
+
 static
 void destroy_pretty_data(struct pretty_component *pretty)
 {
@@ -130,18 +136,19 @@ bt_self_component_status handle_message(
        BT_ASSERT(pretty);
 
        switch (bt_message_get_type(message)) {
-       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
-               if (pretty_print_packet(pretty, message)) {
-                       ret = BT_SELF_COMPONENT_STATUS_ERROR;
-               }
-               break;
        case BT_MESSAGE_TYPE_EVENT:
                if (pretty_print_event(pretty, message)) {
                        ret = BT_SELF_COMPONENT_STATUS_ERROR;
                }
                break;
-       case BT_MESSAGE_TYPE_INACTIVITY:
-               fprintf(stderr, "Inactivity message\n");
+       case BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY:
+               BT_LOGD_STR("Message iterator inactivity message.");
+               break;
+       case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
+       case BT_MESSAGE_TYPE_DISCARDED_PACKETS:
+               if (pretty_print_discarded_items(pretty, message)) {
+                       ret = BT_SELF_COMPONENT_STATUS_ERROR;
+               }
                break;
        default:
                break;
@@ -151,10 +158,8 @@ bt_self_component_status handle_message(
 }
 
 BT_HIDDEN
-bt_self_component_status pretty_port_connected(
-               bt_self_component_sink *comp,
-               bt_self_component_port_input *self_port,
-               const bt_port_output *other_port)
+bt_self_component_status pretty_graph_is_configured(
+               bt_self_component_sink *comp)
 {
        bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK;
        struct pretty_component *pretty;
@@ -164,7 +169,8 @@ bt_self_component_status pretty_port_connected(
        BT_ASSERT(pretty);
        BT_ASSERT(!pretty->iterator);
        pretty->iterator = bt_self_component_port_input_message_iterator_create(
-               self_port);
+               bt_self_component_sink_borrow_input_port_by_name(comp,
+                       in_port_name));
        if (!pretty->iterator) {
                status = BT_SELF_COMPONENT_STATUS_NOMEM;
        }
@@ -649,7 +655,8 @@ bt_self_component_status pretty_init(
                goto end;
        }
 
-       ret = bt_self_component_sink_add_input_port(comp, "in", NULL, NULL);
+       ret = bt_self_component_sink_add_input_port(comp, in_port_name,
+               NULL, NULL);
        if (ret != BT_SELF_COMPONENT_STATUS_OK) {
                goto end;
        }
This page took 0.026792 seconds and 4 git commands to generate.