From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH 2/4] libtraceevent: Add logs with severity info
Date: Wed, 28 Apr 2021 10:29:59 +0300 [thread overview]
Message-ID: <20210428073001.755905-3-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20210428073001.755905-1-tz.stoyanov@gmail.com>
Renamed existing pr_stat() internal function to tep_info() and limit it
to print only when the log level is TEP_LOG_INFO. Removed duplicated and
unused functions:
vpr_stat()
__pr_stat()
__vpr_stat()
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
src/event-parse.c | 14 +++++++-------
src/event-plugin.c | 2 +-
src/event-utils.h | 7 +------
src/parse-utils.c | 24 ++++--------------------
4 files changed, 13 insertions(+), 34 deletions(-)
diff --git a/src/event-parse.c b/src/event-parse.c
index 88ec909..97c1a97 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -6927,8 +6927,8 @@ static int find_event_handle(struct tep_handle *tep, struct tep_event *event)
if (!(*next))
return 0;
- pr_stat("overriding event (%d) %s:%s with new print handler",
- event->id, event->system, event->name);
+ tep_info("overriding event (%d) %s:%s with new print handler",
+ event->id, event->system, event->name);
event->handler = handle->func;
event->context = handle->context;
@@ -7404,7 +7404,7 @@ int tep_register_print_function(struct tep_handle *tep,
* plugins updating the function. This overrides the
* system defaults.
*/
- pr_stat("override of function helper '%s'", name);
+ tep_info("override of function helper '%s'", name);
remove_func_handler(tep, name);
}
@@ -7542,8 +7542,8 @@ int tep_register_event_handler(struct tep_handle *tep, int id,
if (event == NULL)
goto not_found;
- pr_stat("overriding event (%d) %s:%s with new print handler",
- event->id, event->system, event->name);
+ tep_info("overriding event (%d) %s:%s with new print handler",
+ event->id, event->system, event->name);
event->handler = func;
event->context = context;
@@ -7628,8 +7628,8 @@ int tep_unregister_event_handler(struct tep_handle *tep, int id,
goto not_found;
if (event->handler == func && event->context == context) {
- pr_stat("removing override handler for event (%d) %s:%s. Going back to default handler.",
- event->id, event->system, event->name);
+ tep_info("removing override handler for event (%d) %s:%s. Going back to default handler.",
+ event->id, event->system, event->name);
event->handler = NULL;
event->context = NULL;
diff --git a/src/event-plugin.c b/src/event-plugin.c
index df4a0a3..f42243f 100644
--- a/src/event-plugin.c
+++ b/src/event-plugin.c
@@ -497,7 +497,7 @@ load_plugin(struct tep_handle *tep, const char *path,
list->name = plugin;
*plugin_list = list;
- pr_stat("registering plugin: %s", plugin);
+ tep_info("registering plugin: %s", plugin);
func(tep);
return;
diff --git a/src/event-utils.h b/src/event-utils.h
index ff4d6c4..1951557 100644
--- a/src/event-utils.h
+++ b/src/event-utils.h
@@ -9,15 +9,10 @@
#include <ctype.h>
#include <stdarg.h>
+void tep_info(const char *fmt, ...);
/* Can be overridden */
void tep_warning(const char *fmt, ...);
int tep_vwarning(const char *name, const char *fmt, va_list ap);
-void pr_stat(const char *fmt, ...);
-void vpr_stat(const char *fmt, va_list ap);
-
-/* Always available */
-void __pr_stat(const char *fmt, ...);
-void __vpr_stat(const char *fmt, ...);
#define min(x, y) ({ \
typeof(x) _min1 = (x); \
diff --git a/src/parse-utils.c b/src/parse-utils.c
index bc89c44..b997823 100644
--- a/src/parse-utils.c
+++ b/src/parse-utils.c
@@ -50,31 +50,15 @@ void __weak tep_warning(const char *fmt, ...)
va_end(ap);
}
-void __vpr_stat(const char *fmt, va_list ap)
-{
- vprintf(fmt, ap);
- printf("\n");
-}
-void __pr_stat(const char *fmt, ...)
+void tep_info(const char *fmt, ...)
{
va_list ap;
- va_start(ap, fmt);
- __vpr_stat(fmt, ap);
- va_end(ap);
-}
-
-void __weak vpr_stat(const char *fmt, va_list ap)
-{
- __vpr_stat(fmt, ap);
-}
-
-void __weak pr_stat(const char *fmt, ...)
-{
- va_list ap;
+ if (log_level < TEP_LOG_INFO)
+ return;
va_start(ap, fmt);
- __vpr_stat(fmt, ap);
+ tep_vwarning("libtraceevent", fmt, ap);
va_end(ap);
}
--
2.30.2
next prev parent reply other threads:[~2021-04-28 7:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-28 7:29 [PATCH 0/4] Add severity to library logs Tzvetomir Stoyanov (VMware)
2021-04-28 7:29 ` [PATCH 1/4] libtraceevent: Add log levels Tzvetomir Stoyanov (VMware)
2021-04-28 7:29 ` Tzvetomir Stoyanov (VMware) [this message]
2021-05-04 20:00 ` [PATCH 2/4] libtraceevent: Add logs with severity info Steven Rostedt
2021-05-04 20:34 ` Steven Rostedt
2021-05-04 20:24 ` Steven Rostedt
2021-05-05 4:45 ` Tzvetomir Stoyanov
2021-05-05 9:55 ` Steven Rostedt
2021-04-28 7:30 ` [PATCH 3/4] libtraceevent: Rename tep_vwarning() to tep_vprint() Tzvetomir Stoyanov (VMware)
2021-05-04 20:22 ` Steven Rostedt
2021-04-28 7:30 ` [PATCH 4/4] libtraceevent: Document new log functionality 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=20210428073001.755905-3-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 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).