sink.text.pretty: print boolean fields
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sun, 11 Aug 2019 15:42:52 +0000 (11:42 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 4 Sep 2019 15:58:21 +0000 (11:58 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I7fe169bbd23d87af117acff5f1697a7a326b7e2c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1893
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/plugins/text/pretty/print.c

index 5c18a07d5cd4ad5a155f69fc3f75cfdaac6cb13f..1fd168c519868b45b416077d16dc0df41eea2d3b 100644 (file)
@@ -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);
This page took 0.026279 seconds and 4 git commands to generate.