};
struct text_options {
- bool opt_print_all_field_names : 1;
- bool opt_print_scope_field_names : 1;
- bool opt_print_header_field_names : 1;
- bool opt_print_context_field_names : 1;
- bool opt_print_payload_field_names : 1;
- bool opt_print_all_fields : 1;
- bool opt_print_trace_field : 1;
- bool opt_print_trace_domain_field : 1;
- bool opt_print_trace_procname_field : 1;
- bool opt_print_trace_vpid_field : 1;
- bool opt_print_trace_hostname_field : 1;
- bool opt_print_trace_default_fields : 1;
- bool opt_print_loglevel_field : 1;
- bool opt_print_emf_field : 1;
- bool opt_print_delta_field : 1;
+ bool print_scope_field_names : 1;
+ bool print_header_field_names : 1;
+ bool print_context_field_names : 1;
+ bool print_payload_field_names : 1;
+ bool print_delta_field : 1;
+ bool print_loglevel_field : 1;
+ bool print_trace_field : 1;
+ bool print_trace_domain_field : 1;
+ bool print_trace_procname_field : 1;
+ bool print_trace_vpid_field : 1;
+ bool print_trace_hostname_field : 1;
+ bool no_size_limit : 1;
};
struct text_component {
struct text_options options;
+ FILE *out, *err;
};
static
return g_new0(struct text_component, 1);
}
-static void destroy_text(void *data)
+static
+void destroy_text_data(struct text_component *data)
{
g_free(data);
}
+static void destroy_text(struct bt_component *component)
+{
+ void *data = bt_component_get_private_data(component);
+
+ destroy_text_data(data);
+}
+
static
enum bt_component_status handle_notification(struct bt_component *component,
struct bt_notification *notification)
{
+ switch (bt_notification_get_type(notification)) {
+ case BT_NOTIFICATION_TYPE_PACKET_START:
+ puts("<packet>");
+ break;
+ case BT_NOTIFICATION_TYPE_PACKET_END:
+ puts("</packet>");
+ break;
+ case BT_NOTIFICATION_TYPE_EVENT:
+ puts("\t<event>");
+ break;
+ case BT_NOTIFICATION_TYPE_STREAM_END:
+ puts("</stream>");
+ break;
+ default:
+ puts("Unhandled notification type");
+ }
return BT_COMPONENT_STATUS_OK;
}
}
ret = bt_component_sink_set_handle_notification_cb(component,
- handle_notification);
+ handle_notification);
if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
}
+
+ text->out = stdout;
+ text->err = stderr;
end:
return ret;
error:
- destroy_text(text);
+ destroy_text_data(text);
return ret;
}
-
/* Initialize plug-in entry points. */
-BT_PLUGIN_NAME("ctf-text");
+BT_PLUGIN_NAME("text");
BT_PLUGIN_DESCRIPTION("Babeltrace text output plug-in.");
BT_PLUGIN_AUTHOR("Jérémie Galarneau");
BT_PLUGIN_LICENSE("MIT");