cli/babeltrace.c: improve main loop's logging
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 13 May 2017 22:51:10 +0000 (18:51 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:43 +0000 (12:57 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
cli/babeltrace.c

index 00dc4985a472c32f862ebedfd1ab70ddea782e0f..d51229ba523d5a2c293a0d4dd80d84737e35df64 100644 (file)
@@ -1555,6 +1555,31 @@ end:
        return ret;
 }
 
+static inline
+const char *bt_graph_status_str(enum bt_graph_status status)
+{
+       switch (status) {
+       case BT_GRAPH_STATUS_CANCELED:
+               return "BT_GRAPH_STATUS_CANCELED";
+       case BT_GRAPH_STATUS_AGAIN:
+               return "BT_GRAPH_STATUS_AGAIN";
+       case BT_GRAPH_STATUS_END:
+               return "BT_GRAPH_STATUS_END";
+       case BT_GRAPH_STATUS_OK:
+               return "BT_GRAPH_STATUS_OK";
+       case BT_GRAPH_STATUS_ALREADY_IN_A_GRAPH:
+               return "BT_GRAPH_STATUS_ALREADY_IN_A_GRAPH";
+       case BT_GRAPH_STATUS_INVALID:
+               return "BT_GRAPH_STATUS_INVALID";
+       case BT_GRAPH_STATUS_NO_SINK:
+               return "BT_GRAPH_STATUS_NO_SINK";
+       case BT_GRAPH_STATUS_ERROR:
+               return "BT_GRAPH_STATUS_ERROR";
+       default:
+               return "(unknown)";
+       }
+}
+
 static
 int cmd_run(struct bt_config *cfg)
 {
@@ -1592,17 +1617,18 @@ int cmd_run(struct bt_config *cfg)
        while (true) {
                enum bt_graph_status graph_status = bt_graph_run(ctx.graph);
 
+               BT_LOGV("bt_graph_run() returned: status=%s",
+                       bt_graph_status_str(graph_status));
+
                switch (graph_status) {
                case BT_GRAPH_STATUS_OK:
                        break;
                case BT_GRAPH_STATUS_CANCELED:
-                       BT_LOGI("Graph was canceled by user: status=%d",
-                               graph_status);
+                       BT_LOGI_STR("Graph was canceled by user.");
                        goto error;
                case BT_GRAPH_STATUS_AGAIN:
                        if (bt_graph_is_canceled(ctx.graph)) {
-                               BT_LOGI("Graph was canceled by user: status=%d",
-                                       graph_status);
+                               BT_LOGI_STR("Graph was canceled by user.");
                                goto error;
                        }
 
This page took 0.026591 seconds and 4 git commands to generate.