From 8a023fd7471c8695f9f9c7f39abfb0ac7e2b5c4c Mon Sep 17 00:00:00 2001 From: Paul Vinciguerra Date: Sun, 1 Mar 2020 00:47:17 -0500 Subject: [PATCH] vlib: unix cli - log cli commands one per line This changeset modifies the log output so that cli commands now look like: cat /tmp/vpp-cli.log 2020/03/10 19:24:42:186: ***** Start: PID 29570 ***** /* [0] is stdin */ 2020/03/10 19:24:53:518[0]: show clock 2020/03/10 19:24:56:078[0]: show clock 2020/03/10 19:25:01:983[0]: show pci /* [1] is vppctl socket */ 2020/03/10 19:26:14:372[1]: show ver 2020/03/10 19:26:23:395[1]: show hardware-interfaces 2020/03/10 19:26:28:507[1]: q instead of: cat /tmp/vpp-cli.log 2020/03/01 00:40:12:834: ***** Start: PID 29974 ***** 2020/03/01 00:40:24:969[0]: show interface2020/03/01 00:40:31:945[0]: show clo2020/03/01 00:40:41:288[0]: show classify 2020/03/01 00:40:43:753[0]: show classify ?2020/03/01 00:40:53:392[0]: show classify tables2020/03/01 00:40:57:352[0]: quit Type: improvement Change-Id: I38d85535977296d174db7121ae340850b6476a39 Signed-off-by: Paul Vinciguerra --- src/vlib/unix/cli.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c index b0ed9d2db14..6e566d11ffd 100644 --- a/src/vlib/unix/cli.c +++ b/src/vlib/unix/cli.c @@ -2557,6 +2557,8 @@ more: format_timeval, 0 /* current bat-time */ , 0 /* current bat-format */ , cli_file_index, cf->current_command); + if (cf->current_command[vec_len (cf->current_command) - 1] != '\n') + lv = format (lv, "\n"); int rv __attribute__ ((unused)) = write (um->log_fd, lv, vec_len (lv)); } -- 2.16.6