From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] trace-cmd library: Only set trace-cmd log level
Date: Thu, 6 Oct 2022 19:06:21 -0400 [thread overview]
Message-ID: <20221006190621.46bbb606@gandalf.local.home> (raw)
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
Have tracecmd_set_loglevel() only for trace-cmd and not touch libtracefs
and libtraceevent log levels. Let the application handle this instead.
Update the trace-cmd code to keep the same reporting.
Move the updates of libtracefs and libtraceevent log levels from the
library into the application.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
lib/trace-cmd/trace-util.c | 4 +---
tracecmd/include/trace-local.h | 1 +
tracecmd/trace-cmd.c | 11 +++++++++--
tracecmd/trace-read.c | 2 ++
4 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/lib/trace-cmd/trace-util.c b/lib/trace-cmd/trace-util.c
index 108e20cf4b7d..fc61f9d1111b 100644
--- a/lib/trace-cmd/trace-util.c
+++ b/lib/trace-cmd/trace-util.c
@@ -31,7 +31,7 @@
static bool debug;
static bool notimeout;
-static int log_level = TEP_LOG_INFO;
+static int log_level = TEP_LOG_WARNING;
static FILE *logfp;
const static struct {
@@ -393,8 +393,6 @@ trace_load_plugins(struct tep_handle *tep, int flags)
void tracecmd_set_loglevel(enum tep_loglevel level)
{
log_level = level;
- tracefs_set_loglevel(level);
- tep_set_loglevel(level);
}
void __weak tracecmd_warning(const char *fmt, ...)
diff --git a/tracecmd/include/trace-local.h b/tracecmd/include/trace-local.h
index a48a14a5a387..023afb3baad1 100644
--- a/tracecmd/include/trace-local.h
+++ b/tracecmd/include/trace-local.h
@@ -40,6 +40,7 @@ void usage(char **argv);
extern int silence_warnings;
extern int show_status;
+void trace_set_loglevel(int level);
int trace_set_verbose(char *level);
enum port_type {
diff --git a/tracecmd/trace-cmd.c b/tracecmd/trace-cmd.c
index 69800d26c5ee..9646921ca268 100644
--- a/tracecmd/trace-cmd.c
+++ b/tracecmd/trace-cmd.c
@@ -76,6 +76,13 @@ static struct trace_log_severity {
{ .id = TEP_LOG_ALL, .name = "all" },
};
+void trace_set_loglevel(int level)
+{
+ tracecmd_set_loglevel(level);
+ tracefs_set_loglevel(level);
+ tep_set_loglevel(level);
+}
+
int trace_set_verbose(char *level)
{
int id;
@@ -89,7 +96,7 @@ int trace_set_verbose(char *level)
if (id >= TEP_LOG_NONE) {
if (id > TEP_LOG_ALL)
id = TEP_LOG_ALL;
- tracecmd_set_loglevel(id);
+ trace_set_loglevel(id);
return 0;
}
} else {
@@ -98,7 +105,7 @@ int trace_set_verbose(char *level)
for (i = 0; i < size; i++) {
if (!strncmp(level, log_severity[i].name, strlen(log_severity[i].name))) {
- tracecmd_set_loglevel(log_severity[i].id);
+ trace_set_loglevel(log_severity[i].id);
return 0;
}
}
diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index b8931cf95543..d51e3371456f 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -1565,6 +1565,8 @@ void trace_report (int argc, char **argv)
signal(SIGINT, sig_end);
+ trace_set_loglevel(TEP_LOG_INFO);
+
for (;;) {
int option_index = 0;
static struct option long_options[] = {
--
2.35.1
reply other threads:[~2022-10-06 23:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20221006190621.46bbb606@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.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 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).