linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] Add --verbose option to bunch of trace-cmd commands
@ 2021-04-28  7:46 Tzvetomir Stoyanov (VMware)
  2021-04-28  7:46 ` [PATCH 1/7] trace-cmd report: Add --verbose Tzvetomir Stoyanov (VMware)
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2021-04-28  7:46 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

A new option to set log severity is added to these trace-cmd commands:
 report, agent, check-events, listen. stack, dump, start, set, extract,
 stream, profile, record

These changes depend on "[PATCH 0/8] Changes to trace-cmd logs"
https://lore.kernel.org/linux-trace-devel/20210428074149.757163-1-tz.stoyanov@gmail.com/

Tzvetomir Stoyanov (VMware) (7):
  trace-cmd report: Add --verbose
  trace-cmd agent: Add --verbose
  trace-cmd check-events: Add --verbose
  trace-cmd: Add --verbose to bunch of trace-cmd commands
  trace-cmd listen: Add --verbose
  trace-cmd stack: Add --verbose
  trace-cmd dump: Add --verbose

 .../trace-cmd/trace-cmd-check-events.1.txt       |  9 +++++++++
 Documentation/trace-cmd/trace-cmd-dump.1.txt     |  8 ++++++++
 Documentation/trace-cmd/trace-cmd-extract.1.txt  |  8 ++++++++
 Documentation/trace-cmd/trace-cmd-listen.1.txt   |  8 ++++++++
 Documentation/trace-cmd/trace-cmd-profile.1.txt  |  9 +++++++++
 Documentation/trace-cmd/trace-cmd-record.1.txt   |  9 +++++++++
 Documentation/trace-cmd/trace-cmd-report.1.txt   |  9 +++++++++
 Documentation/trace-cmd/trace-cmd-set.1.txt      |  9 +++++++++
 Documentation/trace-cmd/trace-cmd-stack.1.txt    |  4 ++++
 tracecmd/trace-agent.c                           |  6 ++++++
 tracecmd/trace-check-events.c                    | 16 +++++++++++++++-
 tracecmd/trace-dump.c                            |  6 ++++++
 tracecmd/trace-listen.c                          |  6 ++++++
 tracecmd/trace-read.c                            |  6 ++++++
 tracecmd/trace-record.c                          |  6 ++++++
 tracecmd/trace-stack.c                           |  6 ++++++
 tracecmd/trace-usage.c                           | 12 ++++++++++++
 17 files changed, 136 insertions(+), 1 deletion(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/7] trace-cmd report: Add --verbose
  2021-04-28  7:46 [PATCH 0/7] Add --verbose option to bunch of trace-cmd commands Tzvetomir Stoyanov (VMware)
@ 2021-04-28  7:46 ` Tzvetomir Stoyanov (VMware)
  2021-04-28  7:46 ` [PATCH 2/7] trace-cmd agent: " Tzvetomir Stoyanov (VMware)
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2021-04-28  7:46 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

Add new "trace-cmd report --verbose" argument for setting the desired
log level.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 Documentation/trace-cmd/trace-cmd-report.1.txt | 9 +++++++++
 tracecmd/trace-read.c                          | 6 ++++++
 tracecmd/trace-usage.c                         | 1 +
 3 files changed, 16 insertions(+)

diff --git a/Documentation/trace-cmd/trace-cmd-report.1.txt b/Documentation/trace-cmd/trace-cmd-report.1.txt
index 72b47065..e444e8c0 100644
--- a/Documentation/trace-cmd/trace-cmd-report.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-report.1.txt
@@ -312,6 +312,15 @@ OPTIONS
 *--raw-ts*::
      Display raw timestamps, without any corrections.
 
+*--verbose* 'level'::
+     Set the log level. Supported log levels are "none", "critical", "error", "warning",
+     "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log
+     level to specific value enables all logs from that and all previous levels.
+
+     Example: enable all critical, error and warning logs
+
+      trace-cmd report --verbose warning
+
 EXAMPLES
 --------
 
diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index aad57dae..146fdb3c 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -1485,6 +1485,7 @@ static void add_hook(const char *arg)
 }
 
 enum {
+	OPT_verbose	= 235,
 	OPT_raw_ts	= 236,
 	OPT_version	= 237,
 	OPT_tscheck	= 238,
@@ -1578,6 +1579,7 @@ void trace_report (int argc, char **argv)
 			{"ts-diff", no_argument, NULL, OPT_tsdiff},
 			{"ts-check", no_argument, NULL, OPT_tscheck},
 			{"raw-ts", no_argument, NULL, OPT_raw_ts},
+			{"verbose", required_argument, NULL, OPT_verbose},
 			{"help", no_argument, NULL, '?'},
 			{NULL, 0, NULL, 0}
 		};
@@ -1755,6 +1757,10 @@ void trace_report (int argc, char **argv)
 		case OPT_raw_ts:
 			raw_ts = 1;
 			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 98247074..edc43ba9 100644
--- a/tracecmd/trace-usage.c
+++ b/tracecmd/trace-usage.c
@@ -234,6 +234,7 @@ static struct usage_help usage_help[] = {
 		"          --ts-diff Show the delta timestamp between events.\n"
 		"          --ts-check Check to make sure no time stamp on any CPU goes backwards.\n"
 		"          --raw-ts Display raw timestamps, without any corrections.\n"
+		"          --verbose 'level' Set the desired log level\n"
 	},
 	{
 		"stream",
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/7] trace-cmd agent: Add --verbose
  2021-04-28  7:46 [PATCH 0/7] Add --verbose option to bunch of trace-cmd commands Tzvetomir Stoyanov (VMware)
  2021-04-28  7:46 ` [PATCH 1/7] trace-cmd report: Add --verbose Tzvetomir Stoyanov (VMware)
@ 2021-04-28  7:46 ` Tzvetomir Stoyanov (VMware)
  2021-04-28  7:46 ` [PATCH 3/7] trace-cmd check-events: " Tzvetomir Stoyanov (VMware)
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2021-04-28  7:46 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

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 --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",
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/7] trace-cmd check-events: Add --verbose
  2021-04-28  7:46 [PATCH 0/7] Add --verbose option to bunch of trace-cmd commands Tzvetomir Stoyanov (VMware)
  2021-04-28  7:46 ` [PATCH 1/7] trace-cmd report: Add --verbose Tzvetomir Stoyanov (VMware)
  2021-04-28  7:46 ` [PATCH 2/7] trace-cmd agent: " Tzvetomir Stoyanov (VMware)
@ 2021-04-28  7:46 ` Tzvetomir Stoyanov (VMware)
  2021-04-28  7:46 ` [PATCH 4/7] trace-cmd: Add --verbose to bunch of trace-cmd commands Tzvetomir Stoyanov (VMware)
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2021-04-28  7:46 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

Add new "trace-cmd check-events --verbose" argument for setting the desired
log level.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 .../trace-cmd/trace-cmd-check-events.1.txt       |  9 +++++++++
 tracecmd/trace-check-events.c                    | 16 +++++++++++++++-
 tracecmd/trace-usage.c                           |  1 +
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/Documentation/trace-cmd/trace-cmd-check-events.1.txt b/Documentation/trace-cmd/trace-cmd-check-events.1.txt
index c98ff3c6..40c3c8cd 100644
--- a/Documentation/trace-cmd/trace-cmd-check-events.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-check-events.1.txt
@@ -24,6 +24,15 @@ OPTIONS
 -------
 *-N* - Don't load plugins
 
+*--verbose* 'level'::
+     Set the log level. Supported log levels are "none", "critical", "error", "warning",
+     "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log
+     level to specific value enables all logs from that and all previous levels.
+
+     Example: enable all critical, error and warning logs
+
+      trace-cmd check-events --verbose warning
+
 SEE ALSO
 --------
 trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-stop(1),
diff --git a/tracecmd/trace-check-events.c b/tracecmd/trace-check-events.c
index bd19feca..cf34912a 100644
--- a/tracecmd/trace-check-events.c
+++ b/tracecmd/trace-check-events.c
@@ -10,6 +10,10 @@
 #include "tracefs.h"
 #include "trace-local.h"
 
+enum {
+	OPT_verbose	= 255,
+};
+
 void trace_check_events(int argc, char **argv)
 {
 	const char *tracing;
@@ -18,8 +22,14 @@ void trace_check_events(int argc, char **argv)
 	struct tep_handle *pevent = NULL;
 	struct tep_plugin_list *list = NULL;
 	int open_flags = 0;
+	int option_index = 0;
+	static struct option long_options[] = {
+		{"verbose", required_argument, NULL, OPT_verbose},
+		{NULL, 0, NULL, 0}
+	};
+
 
-	while ((c = getopt(argc-1, argv+1, "+hN")) >= 0) {
+	while ((c = getopt_long(argc-1, argv+1, "+hN", long_options, &option_index)) >= 0) {
 		switch (c) {
 		case 'h':
 		default:
@@ -28,6 +38,10 @@ void trace_check_events(int argc, char **argv)
 		case 'N':
 			open_flags |= TRACECMD_FL_LOAD_NO_PLUGINS;
 			break;
+		case OPT_verbose:
+			if (trace_set_verbose(optarg) < 0)
+				die("invalid verbose level %s", optarg);
+			break;
 		}
 	}
 	tracing = tracefs_tracing_dir();
diff --git a/tracecmd/trace-usage.c b/tracecmd/trace-usage.c
index 7019ab97..cacec3c5 100644
--- a/tracecmd/trace-usage.c
+++ b/tracecmd/trace-usage.c
@@ -363,6 +363,7 @@ static struct usage_help usage_help[] = {
 		"parse trace event formats",
 		" %s check-events [-N]\n"
 		"          -N do not load any plugins\n"
+		"          --verbose 'level' Set the desired log level\n"
 	},
 	{
 		"dump",
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/7] trace-cmd: Add --verbose to bunch of trace-cmd commands
  2021-04-28  7:46 [PATCH 0/7] Add --verbose option to bunch of trace-cmd commands Tzvetomir Stoyanov (VMware)
                   ` (2 preceding siblings ...)
  2021-04-28  7:46 ` [PATCH 3/7] trace-cmd check-events: " Tzvetomir Stoyanov (VMware)
@ 2021-04-28  7:46 ` Tzvetomir Stoyanov (VMware)
  2021-04-28  7:46 ` [PATCH 5/7] trace-cmd listen: Add --verbose Tzvetomir Stoyanov (VMware)
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2021-04-28  7:46 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

Add new "--verbose" argument for setting the desired log level to these
trace-cmd commands:
 start
 set
 extract
 stream
 profile
 record

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 Documentation/trace-cmd/trace-cmd-extract.1.txt | 8 ++++++++
 Documentation/trace-cmd/trace-cmd-profile.1.txt | 9 +++++++++
 Documentation/trace-cmd/trace-cmd-record.1.txt  | 9 +++++++++
 Documentation/trace-cmd/trace-cmd-set.1.txt     | 9 +++++++++
 tracecmd/trace-record.c                         | 6 ++++++
 tracecmd/trace-usage.c                          | 6 ++++++
 6 files changed, 47 insertions(+)

diff --git a/Documentation/trace-cmd/trace-cmd-extract.1.txt b/Documentation/trace-cmd/trace-cmd-extract.1.txt
index 4444733d..88749da7 100644
--- a/Documentation/trace-cmd/trace-cmd-extract.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-extract.1.txt
@@ -67,6 +67,14 @@ OPTIONS
     this is the same as the default. But if *-B* or *-a* is used, this is
     required if the top level instance buffer should also be extracted.
 
+*--verbose* 'level'::
+     Set the log level. Supported log levels are "none", "critical", "error", "warning",
+     "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log
+     level to specific value enables all logs from that and all previous levels.
+
+     Example: enable all critical, error and warning logs
+
+      trace-cmd extract --verbose warning
 
 SEE ALSO
 --------
diff --git a/Documentation/trace-cmd/trace-cmd-profile.1.txt b/Documentation/trace-cmd/trace-cmd-profile.1.txt
index 0d1dd8e8..0d285ff7 100644
--- a/Documentation/trace-cmd/trace-cmd-profile.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-profile.1.txt
@@ -90,6 +90,15 @@ These are the same as trace-cmd-record(1) with the *--profile* option.
     is not changed. This allows watching the command execute and saving the
     output of the profile to another file.
 
+*--verbose* 'level'::
+     Set the log level. Supported log levels are "none", "critical", "error", "warning",
+     "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log
+     level to specific value enables all logs from that and all previous levels.
+
+     Example: enable all critical, error and warning logs
+
+      trace-cmd profile --verbose warning
+
 EXAMPLES
 --------
 
diff --git a/Documentation/trace-cmd/trace-cmd-record.1.txt b/Documentation/trace-cmd/trace-cmd-record.1.txt
index 55a8891b..4c4432de 100644
--- a/Documentation/trace-cmd/trace-cmd-record.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-record.1.txt
@@ -360,6 +360,15 @@ OPTIONS
     executed will not be changed. This is useful if you want to monitor the
     output of the command being executed, but not see the output from trace-cmd.
 
+*--verbose* 'level'::
+     Set the log level. Supported log levels are "none", "critical", "error", "warning",
+     "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log
+     level to specific value enables all logs from that and all previous levels.
+
+     Example: enable all critical, error and warning logs
+
+      trace-cmd record --verbose warning
+
 EXAMPLES
 --------
 
diff --git a/Documentation/trace-cmd/trace-cmd-set.1.txt b/Documentation/trace-cmd/trace-cmd-set.1.txt
index 931d3abd..50af7677 100644
--- a/Documentation/trace-cmd/trace-cmd-set.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-set.1.txt
@@ -227,6 +227,15 @@ OPTIONS
     unless the *--fork* option is specified. Then it will fork the command and
     return immediately.
 
+*--verbose* 'level'::
+     Set the log level. Supported log levels are "none", "critical", "error", "warning",
+     "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log
+     level to specific value enables all logs from that and all previous levels.
+
+     Example: enable all critical, error and warning logs
+
+      trace-cmd set --verbose warning
+
 EXAMPLES
 --------
 
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 8805b10e..5b1c0d19 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -5515,6 +5515,7 @@ void init_top_instance(void)
 }
 
 enum {
+	OPT_verbose		= 239,
 	OPT_tsc2nsec		= 240,
 	OPT_fork		= 241,
 	OPT_tsyncinterval	= 242,
@@ -5949,6 +5950,7 @@ static void parse_record_options(int argc,
 			{"tsync-interval", required_argument, NULL, OPT_tsyncinterval},
 			{"fork", no_argument, NULL, OPT_fork},
 			{"tsc2nsec", no_argument, NULL, OPT_tsc2nsec},
+			{"verbose", required_argument, NULL, OPT_verbose},
 			{NULL, 0, NULL, 0}
 		};
 
@@ -6374,6 +6376,10 @@ static void parse_record_options(int argc,
 		case 'q':
 			quiet = 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 cacec3c5..10f06467 100644
--- a/tracecmd/trace-usage.c
+++ b/tracecmd/trace-usage.c
@@ -68,6 +68,7 @@ static struct usage_help usage_help[] = {
 		"               If a negative number is specified, timestamps synchronization is disabled"
 		"               If 0 is specified, no loop is performed - timestamps offset is calculated only twice,"
 		"                                                         at the beginnig and at the end of the trace\n"
+		"          --verbose 'level' Set the desired log level\n"
 	},
 	{
 		"set",
@@ -104,6 +105,7 @@ static struct usage_help usage_help[] = {
 		"          --cmdlines-size change kernel saved_cmdlines_size\n"
 		"          --user execute the specified [command ...] as given user\n"
 		"          --fork return immediately if a command is specified\n"
+		"          --verbose 'level' Set the desired log level\n"
 	},
 	{
 		"start",
@@ -113,6 +115,7 @@ static struct usage_help usage_help[] = {
 		"          It only enables the tracing and exits\n"
 		"\n"
 		"        --fork: If a command is specified, then return right after it forks\n"
+		"        --verbose 'level' Set the desired log level\n"
 	},
 	{
 		"extract",
@@ -123,6 +126,7 @@ static struct usage_help usage_help[] = {
 		"          -B : extract a given buffer (more than one may be specified)\n"
 		"          -a : extract all buffers (except top one)\n"
 		"          -t : extract the top level buffer (useful with -B and -a)\n"
+		"          --verbose 'level' Set the desired log level\n"
 	},
 	{
 		"stop",
@@ -241,6 +245,7 @@ static struct usage_help usage_help[] = {
 		"Start tracing and read the output directly",
 		" %s stream [-e event][-p plugin][-d][-O option ][-P pid]\n"
 		"          Uses same options as record but does not write to files or the network.\n"
+		"          --verbose 'level' Set the desired log level\n"
 	},
 	{
 		"profile",
@@ -249,6 +254,7 @@ static struct usage_help usage_help[] = {
 		"    [-H [start_system:]start_event,start_match[,pid]/[end_system:]end_event,end_match[,flags]\n\n"
 		"          Uses same options as record --profile.\n"
 		"          -H Allows users to hook two events together for timings\n"
+		"          --verbose 'level' Set the desired log level\n"
 	},
 	{
 		"hist",
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/7] trace-cmd listen: Add --verbose
  2021-04-28  7:46 [PATCH 0/7] Add --verbose option to bunch of trace-cmd commands Tzvetomir Stoyanov (VMware)
                   ` (3 preceding siblings ...)
  2021-04-28  7:46 ` [PATCH 4/7] trace-cmd: Add --verbose to bunch of trace-cmd commands Tzvetomir Stoyanov (VMware)
@ 2021-04-28  7:46 ` Tzvetomir Stoyanov (VMware)
  2021-04-28  7:46 ` [PATCH 6/7] trace-cmd stack: " Tzvetomir Stoyanov (VMware)
  2021-04-28  7:46 ` [PATCH 7/7] trace-cmd dump: " Tzvetomir Stoyanov (VMware)
  6 siblings, 0 replies; 8+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2021-04-28  7:46 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

Add new "trace-cmd listen --verbose" argument for setting the desired
log level.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 Documentation/trace-cmd/trace-cmd-listen.1.txt | 8 ++++++++
 tracecmd/trace-listen.c                        | 6 ++++++
 tracecmd/trace-usage.c                         | 1 +
 3 files changed, 15 insertions(+)

diff --git a/Documentation/trace-cmd/trace-cmd-listen.1.txt b/Documentation/trace-cmd/trace-cmd-listen.1.txt
index 8697328c..da841867 100644
--- a/Documentation/trace-cmd/trace-cmd-listen.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-listen.1.txt
@@ -36,6 +36,14 @@ OPTIONS
 *-l* 'filename'::
     This option writes the output messages to a log file instead of standard output.
 
+*--verbose* 'level'::
+     Set the log level. Supported log levels are "none", "critical", "error", "warning",
+     "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log
+     level to specific value enables all logs from that and all previous levels.
+
+     Example: enable all critical, error and warning logs
+
+      trace-cmd listen --verbose warning
 
 SEE ALSO
 --------
diff --git a/tracecmd/trace-listen.c b/tracecmd/trace-listen.c
index 0ae1c948..a72365a2 100644
--- a/tracecmd/trace-listen.c
+++ b/tracecmd/trace-listen.c
@@ -916,6 +916,7 @@ static void start_daemon(void)
 }
 
 enum {
+	OPT_verbose	= 254,
 	OPT_debug	= 255,
 };
 
@@ -938,6 +939,7 @@ void trace_listen(int argc, char **argv)
 			{"port", required_argument, NULL, 'p'},
 			{"help", no_argument, NULL, '?'},
 			{"debug", no_argument, NULL, OPT_debug},
+			{"verbose", required_argument, NULL, OPT_verbose},
 			{NULL, 0, NULL, 0}
 		};
 
@@ -967,6 +969,10 @@ void trace_listen(int argc, char **argv)
 		case OPT_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 10f06467..4c8b1300 100644
--- a/tracecmd/trace-usage.c
+++ b/tracecmd/trace-usage.c
@@ -300,6 +300,7 @@ static struct usage_help usage_help[] = {
 		"          -o file name to use for clients.\n"
 		"          -d directory to store client files.\n"
 		"          -l logfile to write messages to.\n"
+		"          --verbose 'level' Set the desired log level\n"
 	},
 #ifdef VSOCK
 	{
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/7] trace-cmd stack: Add --verbose
  2021-04-28  7:46 [PATCH 0/7] Add --verbose option to bunch of trace-cmd commands Tzvetomir Stoyanov (VMware)
                   ` (4 preceding siblings ...)
  2021-04-28  7:46 ` [PATCH 5/7] trace-cmd listen: Add --verbose Tzvetomir Stoyanov (VMware)
@ 2021-04-28  7:46 ` Tzvetomir Stoyanov (VMware)
  2021-04-28  7:46 ` [PATCH 7/7] trace-cmd dump: " Tzvetomir Stoyanov (VMware)
  6 siblings, 0 replies; 8+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2021-04-28  7:46 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

Add new "trace-cmd stack --verbose" argument for setting the desired
log level.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 Documentation/trace-cmd/trace-cmd-stack.1.txt | 4 ++++
 tracecmd/trace-stack.c                        | 6 ++++++
 tracecmd/trace-usage.c                        | 1 +
 3 files changed, 11 insertions(+)

diff --git a/Documentation/trace-cmd/trace-cmd-stack.1.txt b/Documentation/trace-cmd/trace-cmd-stack.1.txt
index a00c6900..75bd50ba 100644
--- a/Documentation/trace-cmd/trace-cmd-stack.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-stack.1.txt
@@ -24,6 +24,10 @@ stack found since the start was enabled.
 
 Use *--reset* to reset the stack counter to zero.
 
+User *--verbose* 'level' to set the log level. Supported log levels are "none", "critical", "error",
+"warning", "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting
+the log level to specific value enables all logs from that and all previous levels.
+
 SEE ALSO
 --------
 trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1),
diff --git a/tracecmd/trace-stack.c b/tracecmd/trace-stack.c
index 5e88b36c..6f57387a 100644
--- a/tracecmd/trace-stack.c
+++ b/tracecmd/trace-stack.c
@@ -140,6 +140,7 @@ static void read_trace(void)
 }
 
 enum {
+	OPT_verbose	= 252,
 	OPT_reset	= 253,
 	OPT_stop	= 254,
 	OPT_start	= 255,
@@ -163,6 +164,7 @@ void trace_stack (int argc, char **argv)
 			{"stop", no_argument, NULL, OPT_stop},
 			{"reset", no_argument, NULL, OPT_reset},
 			{"help", no_argument, NULL, '?'},
+			{"verbose", required_argument, NULL, OPT_verbose},
 			{NULL, 0, NULL, 0}
 		};
 
@@ -184,6 +186,10 @@ void trace_stack (int argc, char **argv)
 		case OPT_reset:
 			trace_type = STACK_RESET;
 			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 4c8b1300..8a7e8c7b 100644
--- a/tracecmd/trace-usage.c
+++ b/tracecmd/trace-usage.c
@@ -364,6 +364,7 @@ static struct usage_help usage_help[] = {
 		"          --start  enable the stack tracer\n"
 		"          --stop   disable the stack tracer\n"
 		"          --reset  reset the maximum stack found\n"
+		"          --verbose 'level' Set the desired log level\n"
 	},
 	{
 		"check-events",
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 7/7] trace-cmd dump: Add --verbose
  2021-04-28  7:46 [PATCH 0/7] Add --verbose option to bunch of trace-cmd commands Tzvetomir Stoyanov (VMware)
                   ` (5 preceding siblings ...)
  2021-04-28  7:46 ` [PATCH 6/7] trace-cmd stack: " Tzvetomir Stoyanov (VMware)
@ 2021-04-28  7:46 ` Tzvetomir Stoyanov (VMware)
  6 siblings, 0 replies; 8+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2021-04-28  7:46 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

Add new "trace-cmd dump --verbose" argument for setting the desired
log level.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 Documentation/trace-cmd/trace-cmd-dump.1.txt | 8 ++++++++
 tracecmd/trace-dump.c                        | 6 ++++++
 tracecmd/trace-usage.c                       | 1 +
 3 files changed, 15 insertions(+)

diff --git a/Documentation/trace-cmd/trace-cmd-dump.1.txt b/Documentation/trace-cmd/trace-cmd-dump.1.txt
index 0f8626fa..b1a3f90d 100644
--- a/Documentation/trace-cmd/trace-cmd-dump.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-dump.1.txt
@@ -52,6 +52,14 @@ OPTIONS
     Print all meta data from the file.
 *--help*::
     Print usage information.
+*--verbose* 'level'::
+     Set the log level. Supported log levels are "none", "critical", "error", "warning",
+     "info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log
+     level to specific value enables all logs from that and all previous levels.
+
+     Example: enable all critical, error and warning logs
+
+      trace-cmd report --verbose warning
 
 EXAMPLES
 --------
diff --git a/tracecmd/trace-dump.c b/tracecmd/trace-dump.c
index 3f56f65a..5c5447bc 100644
--- a/tracecmd/trace-dump.c
+++ b/tracecmd/trace-dump.c
@@ -678,6 +678,7 @@ static void dump_file(const char *file)
 }
 
 enum {
+	OPT_verbose	= 242,
 	OPT_clock	= 243,
 	OPT_all		= 244,
 	OPT_summary	= 245,
@@ -722,6 +723,7 @@ void trace_dump(int argc, char **argv)
 			{"clock", no_argument, NULL, OPT_clock},
 			{"validate", no_argument, NULL, 'v'},
 			{"help", no_argument, NULL, '?'},
+			{"verbose", required_argument, NULL, OPT_verbose},
 			{NULL, 0, NULL, 0}
 		};
 
@@ -778,6 +780,10 @@ void trace_dump(int argc, char **argv)
 		case OPT_clock:
 			verbosity |= CLOCK;
 			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 8a7e8c7b..1fc11ac3 100644
--- a/tracecmd/trace-usage.c
+++ b/tracecmd/trace-usage.c
@@ -393,6 +393,7 @@ static struct usage_help usage_help[] = {
 		"          --flyrecord information of offset and count of recorded events per CPU\n"
 		"          --clock trace clock, saved in the file\n"
 		"          -h, --help show usage information\n"
+		"          --verbose 'level' Set the desired log level\n"
 	},
 	{
 		NULL, NULL, NULL
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-04-28  7:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28  7:46 [PATCH 0/7] Add --verbose option to bunch of trace-cmd commands Tzvetomir Stoyanov (VMware)
2021-04-28  7:46 ` [PATCH 1/7] trace-cmd report: Add --verbose Tzvetomir Stoyanov (VMware)
2021-04-28  7:46 ` [PATCH 2/7] trace-cmd agent: " Tzvetomir Stoyanov (VMware)
2021-04-28  7:46 ` [PATCH 3/7] trace-cmd check-events: " Tzvetomir Stoyanov (VMware)
2021-04-28  7:46 ` [PATCH 4/7] trace-cmd: Add --verbose to bunch of trace-cmd commands Tzvetomir Stoyanov (VMware)
2021-04-28  7:46 ` [PATCH 5/7] trace-cmd listen: Add --verbose Tzvetomir Stoyanov (VMware)
2021-04-28  7:46 ` [PATCH 6/7] trace-cmd stack: " Tzvetomir Stoyanov (VMware)
2021-04-28  7:46 ` [PATCH 7/7] trace-cmd dump: " Tzvetomir Stoyanov (VMware)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).