diff mbox series

[2/7] trace-cmd agent: Add --verbose

Message ID 20210428074630.757694-3-tz.stoyanov@gmail.com (mailing list archive)
State Accepted
Headers show
Series Add --verbose option to bunch of trace-cmd commands | expand

Commit Message

Tzvetomir Stoyanov (VMware) April 28, 2021, 7:46 a.m. UTC
Add new "trace-cmd agent --verbose" argument for setting the desired
log level.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 tracecmd/trace-agent.c | 6 ++++++
 tracecmd/trace-usage.c | 1 +
 2 files changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/tracecmd/trace-agent.c b/tracecmd/trace-agent.c
index 1f7d9461..0dc339b4 100644
--- a/tracecmd/trace-agent.c
+++ b/tracecmd/trace-agent.c
@@ -281,6 +281,7 @@  busy:
 }
 
 enum {
+	OPT_verbose	= 254,
 	DO_DEBUG	= 255
 };
 
@@ -301,6 +302,7 @@  void trace_agent(int argc, char **argv)
 			{"port", required_argument, NULL, 'p'},
 			{"help", no_argument, NULL, '?'},
 			{"debug", no_argument, NULL, DO_DEBUG},
+			{"verbose", required_argument, NULL, OPT_verbose},
 			{NULL, 0, NULL, 0}
 		};
 
@@ -321,6 +323,10 @@  void trace_agent(int argc, char **argv)
 		case DO_DEBUG:
 			tracecmd_set_debug(true);
 			break;
+		case OPT_verbose:
+			if (trace_set_verbose(optarg) < 0)
+				die("invalid verbose level %s", optarg);
+			break;
 		default:
 			usage(argv);
 		}
diff --git a/tracecmd/trace-usage.c b/tracecmd/trace-usage.c
index edc43ba9..7019ab97 100644
--- a/tracecmd/trace-usage.c
+++ b/tracecmd/trace-usage.c
@@ -303,6 +303,7 @@  static struct usage_help usage_help[] = {
 		"          Creates a vsocket to listen for clients.\n"
 		"          -p port number to listen on.\n"
 		"          -D run in daemon mode.\n"
+		"          --verbose 'level' Set the desired log level\n"
 	},
 	{
 		"setup-guest",