From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> 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@xxxxxxxxxxx> --- 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