+static clib_error_t *
+elog_trace_command_fn (vlib_main_t * vm,
+ unformat_input_t * input, vlib_cli_command_t * cmd)
+{
+ unformat_input_t _line_input, *line_input = &_line_input;
+ int enable = 1;
+ int api = 0, cli = 0, barrier = 0;
+
+ if (!unformat_user (input, unformat_line_input, line_input))
+ goto print_status;
+
+ while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (line_input, "api"))
+ api = 1;
+ else if (unformat (line_input, "cli"))
+ cli = 1;
+ else if (unformat (line_input, "barrier"))
+ barrier = 1;
+ else if (unformat (line_input, "disable"))
+ enable = 0;
+ else if (unformat (line_input, "enable"))
+ enable = 1;
+ else
+ break;
+ }
+ unformat_free (line_input);
+
+ vm->elog_trace_api_messages = api ? enable : vm->elog_trace_api_messages;
+ vm->elog_trace_cli_commands = cli ? enable : vm->elog_trace_cli_commands;
+ vlib_worker_threads->barrier_elog_enabled =
+ barrier ? enable : vlib_worker_threads->barrier_elog_enabled;
+
+print_status:
+ vlib_cli_output (vm, "Current status:");
+
+ vlib_cli_output
+ (vm, " Event log API message trace: %s\n CLI command trace: %s",
+ vm->elog_trace_api_messages ? "on" : "off",
+ vm->elog_trace_cli_commands ? "on" : "off");
+ vlib_cli_output
+ (vm, " Barrier sync trace: %s",
+ vlib_worker_threads->barrier_elog_enabled ? "on" : "off");
+
+ return 0;
+}
+
+/*?
+ * Control event logging of api, cli, and thread barrier events
+ * With no arguments, displays the current trace status.
+ * Name the event groups you wish to trace or stop tracing.
+ *
+ * @cliexpar
+ * @clistart
+ * elog trace api cli barrier
+ * elog trace api cli barrier disable
+ * elog trace
+ * @cliend
+ * @cliexcmd{elog trace [api][cli][barrier][disable]}
+?*/
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (elog_trace_command, static) =
+{
+ .path = "elog trace",
+ .short_help = "elog trace [api][cli][barrier][disable]",
+ .function = elog_trace_command_fn,
+};
+/* *INDENT-ON* */
+