X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=plugins%2Ftext%2Fprint.c;h=41e2dd2aec2caae33967495b82e4b50381c041b1;hb=6e1bc0df89a0af874e3c1f2617e576cbf5e73cf7;hp=2b1be1fc09f39414602c1a52fc8d0d414b772a55;hpb=6a18b281a2bf9df3ac2a3ff08601998c52e40bcd;p=babeltrace.git diff --git a/plugins/text/print.c b/plugins/text/print.c index 2b1be1fc..41e2dd2a 100644 --- a/plugins/text/print.c +++ b/plugins/text/print.c @@ -137,6 +137,10 @@ enum bt_component_status print_event_header(struct text_component *text, ret = BT_COMPONENT_STATUS_ERROR; goto end; } + if (!text->start_line) { + fputs(", ", text->out); + } + text->start_line = false; ret = print_event_timestamp(text, event); if (ret != BT_COMPONENT_STATUS_OK) { goto end; @@ -693,8 +697,12 @@ enum bt_component_status print_stream_packet_context(struct text_component *text ret = BT_COMPONENT_STATUS_ERROR; goto end; } + if (!text->start_line) { + fputs(", ", text->out); + } + text->start_line = false; if (text->options.print_scope_field_names) { - fputs(" stream.packet.context = ", text->out); + fputs("stream.packet.context = ", text->out); } ret = print_field(text, main_field, text->options.print_context_field_names); @@ -716,11 +724,15 @@ enum bt_component_status print_event_header_raw(struct text_component *text, ret = BT_COMPONENT_STATUS_ERROR; goto end; } + if (!text->start_line) { + fputs(", ", text->out); + } + text->start_line = false; if (text->options.print_scope_field_names) { - fputs(" stream.event.header = ", text->out); + fputs("stream.event.header = ", text->out); } ret = print_field(text, main_field, - text->options.print_context_field_names); + text->options.print_header_field_names); end: bt_put(main_field); return ret; @@ -738,8 +750,12 @@ enum bt_component_status print_stream_event_context(struct text_component *text, ret = BT_COMPONENT_STATUS_ERROR; goto end; } + if (!text->start_line) { + fputs(", ", text->out); + } + text->start_line = false; if (text->options.print_scope_field_names) { - fputs(" stream.event.context = ", text->out); + fputs("stream.event.context = ", text->out); } ret = print_field(text, main_field, text->options.print_context_field_names); @@ -760,8 +776,12 @@ enum bt_component_status print_event_context(struct text_component *text, ret = BT_COMPONENT_STATUS_ERROR; goto end; } + if (!text->start_line) { + fputs(", ", text->out); + } + text->start_line = false; if (text->options.print_scope_field_names) { - fputs(" event.context = ", text->out); + fputs("event.context = ", text->out); } ret = print_field(text, main_field, text->options.print_context_field_names); @@ -782,8 +802,12 @@ enum bt_component_status print_event_payload(struct text_component *text, ret = BT_COMPONENT_STATUS_ERROR; goto end; } + if (!text->start_line) { + fputs(", ", text->out); + } + text->start_line = false; if (text->options.print_scope_field_names) { - fputs(" event.fields = ", text->out); + fputs("event.fields = ", text->out); } ret = print_field(text, main_field, text->options.print_payload_field_names); @@ -798,40 +822,31 @@ enum bt_component_status text_print_event(struct text_component *text, { enum bt_component_status ret; - //TEST XXX - text->options.print_scope_field_names = true; - text->options.print_payload_field_names = true; - text->options.print_context_field_names = true; - + text->start_line = true; ret = print_event_header(text, event); if (ret != BT_COMPONENT_STATUS_OK) { goto end; } - fputs(",", text->out); ret = print_stream_packet_context(text, event); if (ret != BT_COMPONENT_STATUS_OK) { goto end; } - fputs(",", text->out); ret = print_event_header_raw(text, event); if (ret != BT_COMPONENT_STATUS_OK) { goto end; } - fputs(",", text->out); ret = print_stream_event_context(text, event); if (ret != BT_COMPONENT_STATUS_OK) { goto end; } - fputs(",", text->out); ret = print_event_context(text, event); if (ret != BT_COMPONENT_STATUS_OK) { goto end; } - fputs(",", text->out); ret = print_event_payload(text, event); if (ret != BT_COMPONENT_STATUS_OK) {