Re: [PATCH] trace-cmd: Suppress trace library warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 15 Apr 2021 11:03:16 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote:

> Suppress all warnings from libtraceevent, libtracefs and libtracecmd if
> the trace-cmd application does not run in debug mode.

Actually, don't we have a -q option to turn off warnings from trace-cmd?

>From the man page:

       -q
           Quiet non critical warnings.

Which I see, currently doesn't work, but should. Not being able to parse
events is something we should keep displaying by default, but it should
not be displayed if -q is on the command line.

-- Steve

> 
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx>
> ---
>  tracecmd/trace-cmd.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/tracecmd/trace-cmd.c b/tracecmd/trace-cmd.c
> index 7376c5a5..7de0671e 100644
> --- a/tracecmd/trace-cmd.c
> +++ b/tracecmd/trace-cmd.c
> @@ -35,6 +35,23 @@ void warning(const char *fmt, ...)
>  	fprintf(stderr, "\n");
>  }
>  
> +int tep_vwarning(const char *name, const char *fmt, va_list ap)
> +{
> +	int ret = errno;
> +
> +	if (!tracecmd_get_debug())
> +		return ret;
> +
> +	if (errno)
> +		perror(name);
> +
> +	fprintf(stderr, "  ");
> +	vfprintf(stderr, fmt, ap);
> +	fprintf(stderr, "\n");
> +
> +	return ret;
> +}
> +
>  void pr_stat(const char *fmt, ...)
>  {
>  	va_list ap;




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux