Linux-Trace-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/3] trace-cmd: Update verbose logic
@ 2021-06-25 20:15 Steven Rostedt
  2021-06-25 20:15 ` [PATCH 1/3] trace-cmd: Do not require --verbose to have an argument Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steven Rostedt @ 2021-06-25 20:15 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Steven Rostedt (VMware)

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>


- Have verbose not require an argument

- Make -V similar to --verbose (but only for numbers)

- Do not force a limit to the verbosity numbers

Steven Rostedt (VMware) (3):
  trace-cmd: Do not require --verbose to have an argument
  trace-cmd report: Have -V take an optional argument
  trace-cmd: Do not enforce upper limit of verbose id

 .../trace-cmd/trace-cmd-check-events.1.txt         |  5 +++--
 Documentation/trace-cmd/trace-cmd-dump.1.txt       |  5 +++--
 Documentation/trace-cmd/trace-cmd-extract.1.txt    |  5 +++--
 Documentation/trace-cmd/trace-cmd-listen.1.txt     |  5 +++--
 Documentation/trace-cmd/trace-cmd-profile.1.txt    |  5 +++--
 Documentation/trace-cmd/trace-cmd-record.1.txt     |  5 +++--
 Documentation/trace-cmd/trace-cmd-report.1.txt     |  9 +++++----
 Documentation/trace-cmd/trace-cmd-set.1.txt        |  5 +++--
 Documentation/trace-cmd/trace-cmd-stack.1.txt      |  5 +++--
 tracecmd/trace-agent.c                             |  2 +-
 tracecmd/trace-check-events.c                      |  2 +-
 tracecmd/trace-cmd.c                               |  7 +++++--
 tracecmd/trace-dump.c                              |  2 +-
 tracecmd/trace-listen.c                            |  2 +-
 tracecmd/trace-read.c                              | 10 ++++------
 tracecmd/trace-record.c                            |  2 +-
 tracecmd/trace-stack.c                             |  2 +-
 tracecmd/trace-usage.c                             | 14 +++++++++++---
 18 files changed, 55 insertions(+), 37 deletions(-)

-- 
2.30.2


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

* [PATCH 1/3] trace-cmd: Do not require --verbose to have an argument
  2021-06-25 20:15 [PATCH 0/3] trace-cmd: Update verbose logic Steven Rostedt
@ 2021-06-25 20:15 ` Steven Rostedt
  2021-06-25 20:15 ` [PATCH 2/3] trace-cmd report: Have -V take an optional argument Steven Rostedt
  2021-06-25 20:15 ` [PATCH 3/3] trace-cmd: Do not enforce upper limit of verbose id Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2021-06-25 20:15 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Steven Rostedt (VMware)

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

In most applications, when specifying a "verbose" argument, they do not
require adding a level of verbosity. Just saying "--verbose" should be
sufficient, unless they want a specific type of verbosity.

Have --verbose be acceptable as an argument without specifying a level.
Unfortunately, it appears that getopt_long() does not recognize the next
argument on the command line as an optional argument, but requires an
equal sign between the "--verbose" and the level. That is, when the user
wants to specify a specific level, they need to do it like so:

  trace-cmd report --verbose=debug

And not like

  trace-cmd report --verbose debug

The man pages are updated to reflect this.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Documentation/trace-cmd/trace-cmd-check-events.1.txt | 5 +++--
 Documentation/trace-cmd/trace-cmd-dump.1.txt         | 5 +++--
 Documentation/trace-cmd/trace-cmd-extract.1.txt      | 5 +++--
 Documentation/trace-cmd/trace-cmd-listen.1.txt       | 5 +++--
 Documentation/trace-cmd/trace-cmd-profile.1.txt      | 5 +++--
 Documentation/trace-cmd/trace-cmd-record.1.txt       | 5 +++--
 Documentation/trace-cmd/trace-cmd-report.1.txt       | 5 +++--
 Documentation/trace-cmd/trace-cmd-set.1.txt          | 5 +++--
 Documentation/trace-cmd/trace-cmd-stack.1.txt        | 5 +++--
 tracecmd/trace-agent.c                               | 2 +-
 tracecmd/trace-check-events.c                        | 2 +-
 tracecmd/trace-cmd.c                                 | 3 ++-
 tracecmd/trace-dump.c                                | 2 +-
 tracecmd/trace-listen.c                              | 2 +-
 tracecmd/trace-read.c                                | 2 +-
 tracecmd/trace-record.c                              | 2 +-
 tracecmd/trace-stack.c                               | 2 +-
 17 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/Documentation/trace-cmd/trace-cmd-check-events.1.txt b/Documentation/trace-cmd/trace-cmd-check-events.1.txt
index 40c3c8cd..debab6c5 100644
--- a/Documentation/trace-cmd/trace-cmd-check-events.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-check-events.1.txt
@@ -24,14 +24,15 @@ OPTIONS
 -------
 *-N* - Don't load plugins
 
-*--verbose* 'level'::
+*--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.
+     The level will default to "info" if one is not specified.
 
      Example: enable all critical, error and warning logs
 
-      trace-cmd check-events --verbose warning
+      trace-cmd check-events --verbose=warning
 
 SEE ALSO
 --------
diff --git a/Documentation/trace-cmd/trace-cmd-dump.1.txt b/Documentation/trace-cmd/trace-cmd-dump.1.txt
index b1a3f90d..9c95244b 100644
--- a/Documentation/trace-cmd/trace-cmd-dump.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-dump.1.txt
@@ -52,14 +52,15 @@ OPTIONS
     Print all meta data from the file.
 *--help*::
     Print usage information.
-*--verbose* 'level'::
+*--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.
+     The level will default to "info" if one is not specified.
 
      Example: enable all critical, error and warning logs
 
-      trace-cmd report --verbose warning
+      trace-cmd report --verbose=warning
 
 EXAMPLES
 --------
diff --git a/Documentation/trace-cmd/trace-cmd-extract.1.txt b/Documentation/trace-cmd/trace-cmd-extract.1.txt
index 88749da7..776da6e1 100644
--- a/Documentation/trace-cmd/trace-cmd-extract.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-extract.1.txt
@@ -67,14 +67,15 @@ 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'::
+*--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.
+     The level will default to "info" if one is not specified.
 
      Example: enable all critical, error and warning logs
 
-      trace-cmd extract --verbose warning
+      trace-cmd extract --verbose=warning
 
 SEE ALSO
 --------
diff --git a/Documentation/trace-cmd/trace-cmd-listen.1.txt b/Documentation/trace-cmd/trace-cmd-listen.1.txt
index da841867..aa6a307f 100644
--- a/Documentation/trace-cmd/trace-cmd-listen.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-listen.1.txt
@@ -36,14 +36,15 @@ OPTIONS
 *-l* 'filename'::
     This option writes the output messages to a log file instead of standard output.
 
-*--verbose* 'level'::
+*--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.
+     The level will default to "info" if one is not specified.
 
      Example: enable all critical, error and warning logs
 
-      trace-cmd listen --verbose warning
+      trace-cmd listen --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 0d285ff7..078ae9e0 100644
--- a/Documentation/trace-cmd/trace-cmd-profile.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-profile.1.txt
@@ -90,14 +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'::
+*--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.
+     The level will default to "info" if one is not specified.
 
      Example: enable all critical, error and warning logs
 
-      trace-cmd profile --verbose warning
+      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 d8065641..96c27108 100644
--- a/Documentation/trace-cmd/trace-cmd-record.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-record.1.txt
@@ -367,14 +367,15 @@ OPTIONS
     Traces are extracted by busy waiting, which will hog the CPUs, so only use
     when really needed.
 
-*--verbose* 'level'::
+*--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.
+     The level will default to "info" if one is not specified.
 
      Example: enable all critical, error and warning logs
 
-      trace-cmd record --verbose warning
+      trace-cmd record --verbose=warning
 
 EXAMPLES
 --------
diff --git a/Documentation/trace-cmd/trace-cmd-report.1.txt b/Documentation/trace-cmd/trace-cmd-report.1.txt
index 3b801a1c..a6c863a8 100644
--- a/Documentation/trace-cmd/trace-cmd-report.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-report.1.txt
@@ -315,14 +315,15 @@ OPTIONS
 *--align-ts*::
      Display timestamps aligned to the first event.
 
-*--verbose* 'level'::
+*--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.
+     The level will default to "info" if one is not specified.
 
      Example: enable all critical, error and warning logs
 
-      trace-cmd report --verbose warning
+      trace-cmd report --verbose=warning
 
 EXAMPLES
 --------
diff --git a/Documentation/trace-cmd/trace-cmd-set.1.txt b/Documentation/trace-cmd/trace-cmd-set.1.txt
index 50af7677..a182d191 100644
--- a/Documentation/trace-cmd/trace-cmd-set.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-set.1.txt
@@ -227,14 +227,15 @@ OPTIONS
     unless the *--fork* option is specified. Then it will fork the command and
     return immediately.
 
-*--verbose* 'level'::
+*--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.
+     The level will default to "info" if one is not specified.
 
      Example: enable all critical, error and warning logs
 
-      trace-cmd set --verbose warning
+      trace-cmd set --verbose=warning
 
 EXAMPLES
 --------
diff --git a/Documentation/trace-cmd/trace-cmd-stack.1.txt b/Documentation/trace-cmd/trace-cmd-stack.1.txt
index 75bd50ba..20752407 100644
--- a/Documentation/trace-cmd/trace-cmd-stack.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-stack.1.txt
@@ -24,9 +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",
+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.
+the log level to specific value enables all logs from that and all previous levels. The level will
+default to "info" if one is not specified.
 
 SEE ALSO
 --------
diff --git a/tracecmd/trace-agent.c b/tracecmd/trace-agent.c
index 0dc339b4..b83d3ac1 100644
--- a/tracecmd/trace-agent.c
+++ b/tracecmd/trace-agent.c
@@ -302,7 +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},
+			{"verbose", optional_argument, NULL, OPT_verbose},
 			{NULL, 0, NULL, 0}
 		};
 
diff --git a/tracecmd/trace-check-events.c b/tracecmd/trace-check-events.c
index cf34912a..46f57e17 100644
--- a/tracecmd/trace-check-events.c
+++ b/tracecmd/trace-check-events.c
@@ -24,7 +24,7 @@ void trace_check_events(int argc, char **argv)
 	int open_flags = 0;
 	int option_index = 0;
 	static struct option long_options[] = {
-		{"verbose", required_argument, NULL, OPT_verbose},
+		{"verbose", optional_argument, NULL, OPT_verbose},
 		{NULL, 0, NULL, 0}
 	};
 
diff --git a/tracecmd/trace-cmd.c b/tracecmd/trace-cmd.c
index 00cdaa37..7f5d1ffd 100644
--- a/tracecmd/trace-cmd.c
+++ b/tracecmd/trace-cmd.c
@@ -62,8 +62,9 @@ int trace_set_verbose(char *level)
 {
 	int id;
 
+	/* Default level is info */
 	if (!level)
-		return -1;
+		level = "info";
 
 	if (isdigit(level[0])) {
 		id = atoi(level);
diff --git a/tracecmd/trace-dump.c b/tracecmd/trace-dump.c
index cf47e7fb..2334b57e 100644
--- a/tracecmd/trace-dump.c
+++ b/tracecmd/trace-dump.c
@@ -730,7 +730,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},
+			{"verbose", optional_argument, NULL, OPT_verbose},
 			{NULL, 0, NULL, 0}
 		};
 
diff --git a/tracecmd/trace-listen.c b/tracecmd/trace-listen.c
index a72365a2..0cb70b7d 100644
--- a/tracecmd/trace-listen.c
+++ b/tracecmd/trace-listen.c
@@ -939,7 +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},
+			{"verbose", optional_argument, NULL, OPT_verbose},
 			{NULL, 0, NULL, 0}
 		};
 
diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index d5687f03..8695f0a4 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -1603,7 +1603,7 @@ void trace_report (int argc, char **argv)
 			{"ts-check", no_argument, NULL, OPT_tscheck},
 			{"raw-ts", no_argument, NULL, OPT_raw_ts},
 			{"align-ts", no_argument, NULL, OPT_align_ts},
-			{"verbose", required_argument, NULL, OPT_verbose},
+			{"verbose", optional_argument, NULL, OPT_verbose},
 			{"help", no_argument, NULL, '?'},
 			{NULL, 0, NULL, 0}
 		};
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index b5f9c5a0..1767a6c6 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -6175,7 +6175,7 @@ static void parse_record_options(int argc,
 			{"fork", no_argument, NULL, OPT_fork},
 			{"tsc2nsec", no_argument, NULL, OPT_tsc2nsec},
 			{"poll", no_argument, NULL, OPT_poll},
-			{"verbose", required_argument, NULL, OPT_verbose},
+			{"verbose", optional_argument, NULL, OPT_verbose},
 			{NULL, 0, NULL, 0}
 		};
 
diff --git a/tracecmd/trace-stack.c b/tracecmd/trace-stack.c
index 6f57387a..80364949 100644
--- a/tracecmd/trace-stack.c
+++ b/tracecmd/trace-stack.c
@@ -164,7 +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},
+			{"verbose", optional_argument, NULL, OPT_verbose},
 			{NULL, 0, NULL, 0}
 		};
 
-- 
2.30.2


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

* [PATCH 2/3] trace-cmd report: Have -V take an optional argument
  2021-06-25 20:15 [PATCH 0/3] trace-cmd: Update verbose logic Steven Rostedt
  2021-06-25 20:15 ` [PATCH 1/3] trace-cmd: Do not require --verbose to have an argument Steven Rostedt
@ 2021-06-25 20:15 ` Steven Rostedt
  2021-06-25 20:15 ` [PATCH 3/3] trace-cmd: Do not enforce upper limit of verbose id Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2021-06-25 20:15 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Steven Rostedt (VMware)

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

By default "-V" will be the same as --verbose=info, but since we allow
--verbose to have an option, do the same with -V. -V will only take a
integer arguments though.

Also updated the documentation of --verbose to the names that are actually
used, and not the extended names ("crit" and not "critical", etc).

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Documentation/trace-cmd/trace-cmd-report.1.txt |  4 ++--
 tracecmd/trace-read.c                          |  8 +++-----
 tracecmd/trace-usage.c                         | 14 +++++++++++---
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/Documentation/trace-cmd/trace-cmd-report.1.txt b/Documentation/trace-cmd/trace-cmd-report.1.txt
index a6c863a8..501994a4 100644
--- a/Documentation/trace-cmd/trace-cmd-report.1.txt
+++ b/Documentation/trace-cmd/trace-cmd-report.1.txt
@@ -164,7 +164,7 @@ OPTIONS
     *-T* is ignored if *-F* is not specified.
 
 *-V*::
-    Show the plugins that are loaded.
+    Show verbose messages (see *--verbose* but only for the numbers)
 
 *-L*::
     This will not load system wide plugins. It loads "local only". That is
@@ -316,7 +316,7 @@ OPTIONS
      Display timestamps aligned to the first event.
 
 *--verbose*[='level']::
-     Set the log level. Supported log levels are "none", "critical", "error", "warning",
+     Set the log level. Supported log levels are "none", "crit", "err", "warn",
      "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.
      The level will default to "info" if one is not specified.
diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index 8695f0a4..6f43c1d2 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -1608,7 +1608,7 @@ void trace_report (int argc, char **argv)
 			{NULL, 0, NULL, 0}
 		};
 
-		c = getopt_long (argc-1, argv+1, "+hSIi:H:feGpRr:tPNn:LlEwF:VvTqO:",
+		c = getopt_long (argc-1, argv+1, "+hSIi:H:feGpRr:tPNn:LlEwF:V::vTqO:",
 			long_options, &option_index);
 		if (c == -1)
 			break;
@@ -1703,10 +1703,6 @@ void trace_report (int argc, char **argv)
 				die("Only 1 -v can be used");
 			neg = 1;
 			break;
-		case 'V':
-			show_status = 1;
-			tracecmd_set_loglevel(TEP_LOG_INFO);
-			break;
 		case 'q':
 			silence_warnings = 1;
 			tracecmd_set_loglevel(TEP_LOG_NONE);
@@ -1784,7 +1780,9 @@ void trace_report (int argc, char **argv)
 		case OPT_align_ts:
 			align_ts = 1;
 			break;
+		case 'V':
 		case OPT_verbose:
+			show_status = 1;
 			if (trace_set_verbose(optarg) < 0)
 				die("invalid verbose level %s", optarg);
 			break;
diff --git a/tracecmd/trace-usage.c b/tracecmd/trace-usage.c
index da0266c6..32b38bfd 100644
--- a/tracecmd/trace-usage.c
+++ b/tracecmd/trace-usage.c
@@ -196,7 +196,7 @@ static struct usage_help usage_help[] = {
 		"report",
 		"read out the trace stored in a trace.dat file",
 		" %s report [-i file] [--cpu cpu] [-e][-f][-l][-P][-L][-N][-R][-E]\\\n"
-		"           [-r events][-n events][-F filter][-v][-V][-T][-O option]\n"
+		"           [-r events][-n events][-F filter][-v][-V[1-6]][-T][-O option]\n"
 		"           [-H [start_system:]start_event,start_match[,pid]/[end_system:]end_event,end_match[,flags]\n"
 		"           [-G]\n"
 		"          -i input file [default trace.dat]\n"
@@ -212,7 +212,8 @@ static struct usage_help usage_help[] = {
 		"          -r raw format the events that match the option\n"
 		"          -v will negate all -F after it (Not show matches)\n"
 		"          -T print out the filter strings created and exit\n"
-		"          -V verbose (shows plugins being loaded)\n"
+		"          -V[level] verbose (shows plugins being loaded)\n"
+		"              With optional level (see --verbose numbers)\n"
 		"          -L load only local (~/.trace-cmd/plugins) plugins\n"
 		"          -N do not load any plugins\n"
 		"          -n ignore plugin handlers for events that match the option\n"
@@ -240,7 +241,14 @@ static struct usage_help usage_help[] = {
 		"          --ts-check Check to make sure no time stamp on any CPU goes backwards.\n"
 		"          --raw-ts Display raw timestamps, without any corrections.\n"
 		"          --align-ts Display timestamps aligned to the first event.\n"
-		"          --verbose 'level' Set the desired log level\n"
+		"          --verbose[=level] Set the desired log level\n"
+		"                0 or none  - no error messages\n"
+		"                1 or crit  - only critical messages\n"
+		"                2 or err   - 'crit' and error messages\n"
+		"                3 or warn  - 'err' and warning messages\n"
+		"                4 or info  - 'warn' and informational messages\n"
+		"                5 or debug - 'info' and debugging messages\n"
+		"                6 or all   - same as debug\n"
 	},
 	{
 		"stream",
-- 
2.30.2


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

* [PATCH 3/3] trace-cmd: Do not enforce upper limit of verbose id
  2021-06-25 20:15 [PATCH 0/3] trace-cmd: Update verbose logic Steven Rostedt
  2021-06-25 20:15 ` [PATCH 1/3] trace-cmd: Do not require --verbose to have an argument Steven Rostedt
  2021-06-25 20:15 ` [PATCH 2/3] trace-cmd report: Have -V take an optional argument Steven Rostedt
@ 2021-06-25 20:15 ` Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2021-06-25 20:15 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Steven Rostedt (VMware)

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Applications that have a "verbose" option, do not usually set an upper
limit of what can be passed in. If the max is -V6, trace-cmd should not
error if someone passes in -V7. The way this is handled, is just set the
verbosity to the highest level if the number supplied is above the highest
level.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tracecmd/trace-cmd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tracecmd/trace-cmd.c b/tracecmd/trace-cmd.c
index 7f5d1ffd..9fc126e4 100644
--- a/tracecmd/trace-cmd.c
+++ b/tracecmd/trace-cmd.c
@@ -68,7 +68,9 @@ int trace_set_verbose(char *level)
 
 	if (isdigit(level[0])) {
 		id = atoi(level);
-		if (id >= TEP_LOG_NONE && id <= TEP_LOG_ALL) {
+		if (id >= TEP_LOG_NONE) {
+			if (id > TEP_LOG_ALL)
+				id = TEP_LOG_ALL;
 			tracecmd_set_loglevel(id);
 			return 0;
 		}
-- 
2.30.2


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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 20:15 [PATCH 0/3] trace-cmd: Update verbose logic Steven Rostedt
2021-06-25 20:15 ` [PATCH 1/3] trace-cmd: Do not require --verbose to have an argument Steven Rostedt
2021-06-25 20:15 ` [PATCH 2/3] trace-cmd report: Have -V take an optional argument Steven Rostedt
2021-06-25 20:15 ` [PATCH 3/3] trace-cmd: Do not enforce upper limit of verbose id Steven Rostedt

Linux-Trace-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-trace-devel/0 linux-trace-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-trace-devel linux-trace-devel/ https://lore.kernel.org/linux-trace-devel \
		linux-trace-devel@vger.kernel.org
	public-inbox-index linux-trace-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-trace-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git