[PATCH] lib: remove duplicate prefix in logs

Bruce Richardson bruce.richardson at intel.com
Wed Jan 24 14:26:58 CET 2024


On Wed, Jan 24, 2024 at 01:04:49PM +0100, David Marchand wrote:
> RTE_LOG() macros prefixe the log messages based on the logtype.
> This results in logs like:
> 
> TMTY: TELEMETRY: Attempting socket bind to path '/run/user/...'
> TMTY: TELEMETRY: Socket creation and binding ok
> TMTY: TELEMETRY: Telemetry initialized ok
> 
> Remove redundancy in some libraries following their conversion to
> RTE_LOG/RTE_LOG_LINE.
> 
> Fixes: 97433132c2ed ("lib: use per line logging in helpers")
> Fixes: 0e21c7c07d62 ("lib: replace logging helpers")
> 
> Reported-by: Thomas Monjalon <thomas at monjalon.net>
> Signed-off-by: David Marchand <david.marchand at redhat.com>
> ---
>  lib/dmadev/rte_dmadev.c   | 3 +--
>  lib/gpudev/gpudev.c       | 3 +--
>  lib/graph/graph_private.h | 2 +-
>  lib/node/node_private.h   | 2 +-
>  lib/telemetry/telemetry.c | 4 ++--
>  lib/vhost/vhost.h         | 6 +++---
>  6 files changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
> index 5953a77bd6..dbaa14f262 100644
> --- a/lib/dmadev/rte_dmadev.c
> +++ b/lib/dmadev/rte_dmadev.c
> @@ -35,8 +35,7 @@ RTE_LOG_REGISTER_DEFAULT(rte_dma_logtype, INFO);
>  #define RTE_LOGTYPE_DMA rte_dma_logtype
>  
>  #define RTE_DMA_LOG(level, ...) \
> -	RTE_LOG_LINE(level, DMA, RTE_FMT("dma: " RTE_FMT_HEAD(__VA_ARGS__ ,), \
> -		RTE_FMT_TAIL(__VA_ARGS__ ,)))
> +	RTE_LOG_LINE(level, DMA, "" __VA_ARGS__)
>  

Is it not useful to have the prefix in the log macro itself? That way it's
consistent across all messages.

/Bruce


More information about the dev mailing list