All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH 4/7] trace-cmd: Add --verbose to bunch of trace-cmd commands
Date: Wed, 28 Apr 2021 10:46:27 +0300	[thread overview]
Message-ID: <20210428074630.757694-5-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20210428074630.757694-1-tz.stoyanov@gmail.com>

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


  parent reply	other threads:[~2021-04-28  7:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Tzvetomir Stoyanov (VMware) [this message]
2021-04-28  7:46 ` [PATCH 5/7] trace-cmd listen: " 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)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210428074630.757694-5-tz.stoyanov@gmail.com \
    --to=tz.stoyanov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.