From: Philippe Proulx Date: Sun, 11 Aug 2019 15:42:52 +0000 (-0400) Subject: sink.text.pretty: print boolean fields X-Git-Tag: v2.0.0-rc1~282 X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=4a9029cb2decdb458083fcefca55399f8cc59302;p=babeltrace.git 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 --- 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);