@@ -9,10 +9,10 @@
#include <ctype.h>
#include <stdarg.h>
+void tep_warning(const char *fmt, ...);
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);
+int tep_vprint(const char *name, enum tep_loglevel level, const char *fmt, va_list ap);
#define min(x, y) ({ \
typeof(x) _min1 = (x); \
@@ -24,11 +24,11 @@ void tep_set_loglevel(enum tep_loglevel level)
log_level = level;
}
-int __weak tep_vwarning(const char *name, const char *fmt, va_list ap)
+int __weak tep_vprint(const char *name, enum tep_loglevel level, const char *fmt, va_list ap)
{
int ret = errno;
- if (errno)
+ if (errno && level <= TEP_LOG_WARNING)
perror(name);
fprintf(stderr, " ");
@@ -38,7 +38,7 @@ int __weak tep_vwarning(const char *name, const char *fmt, va_list ap)
return ret;
}
-void __weak tep_warning(const char *fmt, ...)
+void tep_warning(const char *fmt, ...)
{
va_list ap;
@@ -46,7 +46,7 @@ void __weak tep_warning(const char *fmt, ...)
return;
va_start(ap, fmt);
- tep_vwarning("libtraceevent", fmt, ap);
+ tep_vprint("libtraceevent", TEP_LOG_WARNING, fmt, ap);
va_end(ap);
}
@@ -59,6 +59,6 @@ void tep_info(const char *fmt, ...)
return;
va_start(ap, fmt);
- tep_vwarning("libtraceevent", fmt, ap);
+ tep_vprint("libtraceevent", TEP_LOG_INFO, fmt, ap);
va_end(ap);
}
Renamed the existing weak function tep_vwarning() to tep_vprint(), to match its purpose. This function is used to print library logs with any log severity, not only warnings. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- src/event-utils.h | 4 ++-- src/parse-utils.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-)