[dpdk-dev] [PATCH] rte_log.h: display level in logs from RTE_LOG

Panu Matilainen pmatilai at redhat.com
Fri Nov 13 14:11:09 CET 2015


On 11/13/2015 07:50 AM, Matthew Hall wrote:
> Signed-off-by: Matthew Hall <mhall at mhcomputing.net>
> ---
>   lib/librte_eal/common/include/rte_log.h | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
> index ede0dca..be961d0 100644
> --- a/lib/librte_eal/common/include/rte_log.h
> +++ b/lib/librte_eal/common/include/rte_log.h
> @@ -297,10 +297,10 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
>    *   - 0: Success.
>    *   - Negative on error.
>    */
> -#define RTE_LOG(l, t, ...)					\
> -	(void)((RTE_LOG_ ## l <= RTE_LOG_LEVEL) ?		\
> -	 rte_log(RTE_LOG_ ## l,					\
> -		 RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) :	\
> +#define RTE_LOG(l, t, ...)						\
> +	(void)((RTE_LOG_ ## l <= RTE_LOG_LEVEL) ?			\
> +	 rte_log(RTE_LOG_ ## l,						\
> +		 RTE_LOGTYPE_ ## t, # t ": " #l ": " __VA_ARGS__) :	\
>   	 0)
>
>   #ifdef __cplusplus
>

+1 for this, makes it much easier to spot the actually important 
messages from all the other noise. Both visually and programmatically.

	- Panu -


More information about the dev mailing list