From ff87f7c69a536eb131170561f24b1c676741b5de Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Sun, 11 Aug 2019 11:42:52 -0400 Subject: [PATCH] sink.text.pretty: print boolean fields Signed-off-by: Philippe Proulx Change-Id: I7fe169bbd23d87af117acff5f1697a7a326b7e2c Reviewed-on: https://review.lttng.org/c/babeltrace/+/1893 Tested-by: jenkins Reviewed-by: Francis Deslauriers --- src/plugins/text/pretty/print.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/plugins/text/pretty/print.c b/src/plugins/text/pretty/print.c index 5c18a07d..1fd168c5 100644 --- a/src/plugins/text/pretty/print.c +++ b/src/plugins/text/pretty/print.c @@ -949,6 +949,26 @@ int print_field(struct pretty_component *pretty, class_id = bt_field_get_class_type(field); switch (class_id) { + case BT_FIELD_CLASS_TYPE_BOOL: + { + bt_bool v; + const char *text; + + v = bt_field_bool_get_value(field); + if (pretty->use_colors) { + bt_common_g_string_append(pretty->string, COLOR_NUMBER_VALUE); + } + if (v) { + text = "true"; + } else { + text = "false"; + } + bt_common_g_string_append(pretty->string, text); + if (pretty->use_colors) { + bt_common_g_string_append(pretty->string, COLOR_RST); + } + return 0; + } case BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER: case BT_FIELD_CLASS_TYPE_SIGNED_INTEGER: return print_integer(pretty, field); -- 2.34.1