On Wed, 5 May 2021 07:45:44 +0300 Tzvetomir Stoyanov <tz.stoyanov@xxxxxxxxx> wrote: > On Tue, May 4, 2021 at 11:24 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > > > > On Wed, 28 Apr 2021 10:29:59 +0300 > > "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote: > > > > And let the tep_vprint() decide to print it or not. > > The tep_vprint() is used also by libtacecmd and libtracefs for > printing logs. Each library has its own log_level local variable, > that's why I check the log level in the library specific log > functions. But tep_vprint() looks like this: int __weak tep_vprint(const char *name, enum tep_loglevel level, const char *fmt, va_list ap) { int ret = errno; if (errno && level <= TEP_LOG_WARNING) perror(name); fprintf(stderr, " "); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); return ret; } That check of the log level is confusing. Just remove it. In fact, we should add a boolean on whether to print the errno message or not. Like this: int __weak tep_vprint(const char *name, bool print_errno, const char *fmt, va_list ap) { int ret = errno; if (errno && print_errno) perror(name); fprintf(stderr, " "); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); return ret; } That would make a lot more sense, and let the callers of it decide to print it or not, and not have the internal level of libtraceevent decide. -- Steve